Massimo Prota's BLog

Nothin' but .NET
posts - 44, comments - 43, trackbacks - 4

My Links

News

View Massimo Prota's profile on LinkedIn

Archives

Post Categories

Blogs

Links

[CodeSnippet] Ottenere l'hash SHA-1 di una stringa

Una funzione che può essere utilizzata per ottenere l'hash SHA-1 di una password e ritorna una stringa da poter inserire in un campo "varchar" del DB

internal static string EncryptString(string sourceString){
   byte[] b = System.Text.Encoding.ASCII.GetBytes(sourceString);
   return Convert.ToBase64String(((HashAlgorithm)CryptoConfig.CreateFromName("SHA1")).ComputeHash(b));
}


 

Print | posted on giovedì 8 aprile 2004 22.33 | Filed Under [ Code Snippet ]

Feedback

No comments posted yet.

Post Comment

Title  
Name  
Email
Url
Comment   
Please add 1 and 4 and type the answer here:

Powered by: