Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Security.Cryptography;
- using System.Text;
- public static class SaveHash
- {
- const string SECRET = "phoque-mange-mieux-et-code-plus";
- public static string Compute(string data)
- {
- using SHA256 sha = SHA256.Create();
- byte[] bytes = Encoding.UTF8.GetBytes(data + SECRET);
- byte[] hash = sha.ComputeHash(bytes);
- StringBuilder sb = new StringBuilder();
- foreach (byte b in hash)
- sb.Append(b.ToString("x2"));
- return sb.ToString();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment