Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string SHA512(string strToEncrypt){
- System.Text.UTF8Encoding ue = new System.Text.UTF8Encoding ();
- byte[] bytes = ue.GetBytes (strToEncrypt);
- //encrypt bytes
- System.Security.Cryptography.SHA512 sha512 = System.Security.Cryptography.SHA512.Create ();
- byte[] hashBytes = sha512.ComputeHash (bytes);
- //convert hashed bytes back to utf8 encoding
- string hashString = "";
- for (int i = 0; i < hashBytes.Length; i++) {
- hashString += System.Convert.ToString(hashBytes[i], 16).PadLeft(2, '0');
- }
- return hashString.PadLeft(32, '0');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement