Exemplo n.º 1
0
 public static string TextToHash(string text, HashType hashType, bool uppercase = false)
 {
     using (HashAlgorithm hash = HashCheck.GetHashAlgorithm(hashType))
     {
         byte[]   bytes  = hash.ComputeHash(Encoding.UTF8.GetBytes(text));
         string[] hex    = BytesToHexadecimal(bytes);
         string   result = string.Concat(hex);
         if (uppercase)
         {
             result = result.ToUpperInvariant();
         }
         return(result);
     }
 }