public static string ComputeHash(HashAlgorithm hashAlgorithm, string source) { StringHashBuilder stringHashBuilder = new StringHashBuilder(hashAlgorithm); stringHashBuilder.Append(source); return(stringHashBuilder.ComputeHash()); }
internal string ComputeHash() { int byteCount = this.GetByteCount(); if (this._cachedBuffer == null) { this._cachedBuffer = new byte[byteCount]; } else if (this._cachedBuffer.Length < byteCount) { this._cachedBuffer = new byte[Math.Max(this._cachedBuffer.Length + this._cachedBuffer.Length / 2, byteCount)]; } int byteIndex = 0; foreach (string s in this._strings) { byteIndex += Encoding.Unicode.GetBytes(s, 0, s.Length, this._cachedBuffer, byteIndex); } return(StringHashBuilder.ConvertHashToString(this._hashAlgorithm.ComputeHash(this._cachedBuffer, 0, byteCount))); }
public static string ComputeHash(HashAlgorithm hashAlgorithm, string source) { var builder = new StringHashBuilder(hashAlgorithm); builder.Append(source); return builder.ComputeHash(); }