src/Microsoft.OpenApi.OData.Reader/Common/CryptographyExtensions.cs
/// <summary>
/// Calculates the SHA256 hash for the given string.
/// </summary>
/// <returns>A 64 char long hash.</returns>
Calculates the SHA256 hash for the given string.
Calculates the SHA256 hash for the given string .
public static string GetHashSHA256(this string input)
        {
            Utils.CheckArgumentNull(input, nameof(input));
            var hasher = new SHA256CryptoServiceProvider();
            var inputBytes = Encoding.UTF8.GetBytes(input);
            var hashBytes = hasher.ComputeHash(inputBytes);
            var hash = new StringBuilder();
            foreach (var b in hashBytes)
            {
                hash.Append(string.Format("{0:x2}", b));
            }
            return hash.ToString();
        }
public static string GetHashSHA256 ( this string input ) { Utils . CheckArgumentNull ( input , nameof ( input ) ) ; var hasher = new SHA256CryptoServiceProvider ( ) ; var inputBytes = Encoding . UTF8 . GetBytes ( input ) ; var hashBytes = hasher . ComputeHash ( inputBytes ) ; var hash = new StringBuilder ( ) ; foreach ( var b in hashBytes ) { hash . Append ( string . Format ( " " , b ) ) ; } return hash . ToString ( ) ; }
Calculates the SHA256 hash for the given string.
Calculates the SHA256 hash for the given string .
A 64 char long hash.
A 64 char long hash .
string
this