Cryptography l'algoritmo SHA1

Posto un metodo per la creazione di un Hash con l'algorimo SHA1.

/// <summary>
/// Genera una string di Hashing utilizzadno l'algoritmo SHA1
/// </summary>
/// <param name="text">Testo in ingresso</param>
/// <returns></returns>

public static String GetHash(String text)
{

//Trasformo la stringa in un array di byte
Byte[] textByte = ASCIIEncoding.ASCII.GetBytes(text);

//Instanzio la classe completamente Managed per gestire l'hash
SHA1Managed sha = new SHA1Managed();

//Cripto il testo
Byte[] textCryto = sha.ComputeHash(textByte);

return BitConverter.ToString(textCryto);

}

posted @ martedì 17 aprile 2007 15:17

Print
Comments have been closed on this topic.
«aprile»
domlunmarmergiovensab
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011