Jamie Cansdale's Radio Weblog


Subscribe to "Jamie Cansdale's Radio Weblog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


02 January 2003
 

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    


Click here to visit the Radio UserLand website. © Copyright 2003 Jamie Cansdale.
Last update: 01/02/2003; 11:09:35.
January 2003
Sun Mon Tue Wed Thu Fri Sat
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  
Dec   Feb