fork download
  1. using System;
  2. using System.Security.Cryptography;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. Console.WriteLine(CriptSha1("teste"));
  9. }
  10.  
  11. public static string CriptSha1(string secret)
  12. {
  13.  
  14. string result = "";
  15.  
  16. byte[] key = System.Text.Encoding.UTF8.GetBytes(secret);
  17.  
  18. SHA1 sha1 = SHA1Managed.Create();
  19.  
  20. byte[] hash = sha1.ComputeHash(key);
  21.  
  22. foreach (byte b in hash)
  23. {
  24. result += b.ToString("X2");
  25. }
  26.  
  27. return result;
  28. }
  29. }
Success #stdin #stdout 0.09s 25192KB
stdin
Standard input is empty
stdout
2E6F9B0D5885B6010F9167787445617F553A735F