Esta entrada también está disponible en: Spanish
Method to crypt with SHA1
///
/// Crypt the string with SHA1
///
public static string EncriptarSHA1(string sCadena)
{
System.Security.Cryptography.SHA1 sha1 = System.Security.Cryptography.SHA1Managed.Create();
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] stream = null;
StringBuilder codificada = new StringBuilder();
stream = sha1.ComputeHash(encoding.GetBytes(sCadena));
for (int i = 0; i < stream.Length; i++) codificada.AppendFormat("{0:x2}", stream[i]);
return codificada.ToString();
}