Eonirr

Untitled

Feb 9th, 2026
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. using System.Security.Cryptography;
  2. using System.Text;
  3.  
  4. public static class SaveHash
  5. {
  6. const string SECRET = "phoque-mange-mieux-et-code-plus";
  7.  
  8. public static string Compute(string data)
  9. {
  10. using SHA256 sha = SHA256.Create();
  11. byte[] bytes = Encoding.UTF8.GetBytes(data + SECRET);
  12. byte[] hash = sha.ComputeHash(bytes);
  13.  
  14. StringBuilder sb = new StringBuilder();
  15. foreach (byte b in hash)
  16. sb.Append(b.ToString("x2"));
  17.  
  18. return sb.ToString();
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment