MD5 Password Hash Pattern
Here's a little code snippet that hashes the plain-text customer password for storage in a database table:
sqlConnection.Open();
SqlCommand cmd = sqlCmdCustomerAdd;
cmd.Parameters["@guid"].Value = Guid.NewGuid();
cmd.Parameters["@email"].Value = tbEmail.Text;
byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes(tbPassword.Text);
byte[] passwordHash = ((HashAlgorithm) CryptoConfig.CreateFromName("MD5")).ComputeHash(passwordBytes);
cmd.Parameters["@password"].Value = Convert.ToBase64String(passwordHash);
cmd.ExecuteNonQuery();
sqlConnection.Close();