Nel tutorial di oggi vi mostreremo come creare una funzione che permette di ottenere lo SHA1 di una stringa.
public static byte[] GetHash(string inputString) { HashAlgorithm algorithm = SHA1.Create(); // SHA1.Create() return algorithm.ComputeHash(Encoding.UTF8.GetBytes(inputString)); } public static string GetHashString(string inputString) { StringBuilder sb = new StringBuilder(); foreach (byte b in GetHash(inputString)) sb.Append(b.ToString("X2")); return sb.ToString(); }



Leave Your Response