Reinventing the cryptographic wheel
I've seen a lot of articles that contain some home-brewed algorithm for converting a string password into a cryptographic key for use with symmetric encryption (DES, Triple-DES, Rijndael, etc.)
You don't need an algorithm for this; it's already in the box.
byte[] salt = new byte[2] {200, 100}; // can also use null salt PasswordDeriveBytes p = new PasswordDeriveBytes("MyPassword",salt); int bytesInKey = 32; byte[] key = p.GetBytes(bytesInKey); foreach (byte b in key) { Console.Write(b.ToString("X")); } Console.WriteLine();
Returns:
8134CDE1B8E01F9A1B261CAC17D8BBF7E0A9CD839526638F4DC2355473C98
[Sean 'Early' Campbell & Scott 'Adopter' Swigart's Radio Weblog]
10:34:00 PM
|