Could this make Vignere more secure?

This is a discussion on Could this make Vignere more secure? within the C# Programming forums, part of the General Programming Boards category; I'm wondering if the Vegenere cipher could be more secure if the key generation technique below is used... In this ...

  1. #1
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218

    Could this make Vigenere more secure?

    I'm wondering if the Vegenere cipher could be more secure if the key generation technique below is used...

    In this method, the first key is the SHA-512 hash of the given password. When all 64 bytes of that key have been used, another key is generated, this one being the SHA-512 hash of the previous key. This is repeated until the encryption is complete.

    This method is an attempt to foil the Kasiski examination.

    The equations for encryption/decryption are:

    Ci = Pi + Ki (mod 256)
    Pi = Ci - Ki (mod 256)

    Which are modified from the original equations so that they can be used on computers with any type of file, not just text.

    Edit: Guess I should post the code!

    Code:
    	public void VigEncryptData(string inFile, string outFile, string password)
    	{
    		SHA512 hash = new SHA512Managed();
    
    		byte[] key = hash.ComputeHash(System.Text.Encoding.UTF8.GetBytes(password));
    
    		FileStream fin  = new FileStream(inFile, FileMode.Open, FileAccess.Read);
    		FileStream fout = new FileStream(outFile, FileMode.OpenOrCreate, FileAccess.Write);
    
    		int i=0, ii=0;
    
    		while(i < fin.Length)
    		{
    			int c = fin.ReadByte();
    			c = (int)(c + key[ii] % 256);
    			fout.WriteByte((byte)c);
    			if(ii == key.Length-1)
    			{
    				key = hash.ComputeHash(key);
    				ii = 0;
    			}
    			i++;
    			ii++;
    		}
    		fin.Close();
    		fout.Close();
    	}
    Last edited by kinghajj; 03-28-2005 at 10:44 PM.
    01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000

  2. #2
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    At least standard Vigenère decryption wouldn't work, but I don't know if it'll be much more secure. Why not use a 'standard' well-tested algorithm?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  3. #3
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    Quote Originally Posted by Sang-drax
    At least standard Vigenère decryption wouldn't work, but I don't know if it'll be much more secure. Why not use a 'standard' well-tested algorithm?
    I am. My program, so far, uses Rijndael (256-bit key/256-bit blocks) and the Vigenere cipher above.
    01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000

  4. #4
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    But Vigenère ciphers aren't secure at all. Instead of trying to enhance it you could use another cipher which has been tested thoroughly.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  5. #5
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    Quote Originally Posted by Sang-drax
    But Vigenère ciphers aren't secure at all. Instead of trying to enhance it you could use another cipher which has been tested thoroughly.
    Ok; like I said in my last post, I am using a different cipher (which is the default one in my program).
    01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000

  6. #6
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Why even bother using a Vignere cipher if you're already using Rijndael? It's the current AES cipher, so it's pretty dang secure. (And the math behind it hurts my brain. )
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  7. #7
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    Quote Originally Posted by XSquared
    Why even bother using a Vignere cipher if you're already using Rijndael? It's the current AES cipher, so it's pretty dang secure. (And the math behind it hurts my brain. )
    My program will have many different ciphers, hopefully. I might add DES/Triple DES, too.
    01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000

  8. #8
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    What exactly does your program do?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  9. #9
    Registered User kinghajj's Avatar
    Join Date
    Jun 2003
    Posts
    218
    Quote Originally Posted by XSquared
    What exactly does your program do?
    It's a file-encryption program. It's availible here.
    01011001 01101111 01110101 00100000 01110100 01101111 01101111 1101011 00100000 01110100 01101000 01101001 01110011 00100000 01101101 01110101 01100011 01101000 00100000 01110100 01101000 01101101 01100101 00100000 01110100 01101111 00100000 01110010 01100101 01100001 01100100 00100000 01011001 01101000 01101001 01110011 00111111 00100000 01000100 01100001 01101101 01101110 00100001 00000000

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Establishing 'make clean' with GNU make
    By Jesdisciple in forum C Programming
    Replies: 9
    Last Post: 04-11-2009, 10:10 AM
  2. How to make a Packet sniffer/filter?
    By shown in forum C++ Programming
    Replies: 2
    Last Post: 02-22-2009, 09:51 PM
  3. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 12:50 PM
  4. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 03:16 PM
  5. gmake or make, what's the difference?
    By Hubas in forum C++ Programming
    Replies: 0
    Last Post: 02-13-2002, 04:42 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21