private static string GetHashString(byte[] input) { if (input == null) { throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); } string text = BitConverter.ToString(MD5Util.GetHash(input)); return(text.Replace("-", "")); }
private static byte[] GetHash(string input, Encoding encoding) { if (input == null) { throw new ArgumentNullException("input", "Unable to calculate hash over null input data"); } if (encoding == null) { throw new ArgumentNullException("encoding", "Unable to calculate hash over a string without a default encoding. Consider using the GetHash(string) overload to use UTF8 Encoding"); } byte[] bytes = encoding.GetBytes(input); return(MD5Util.GetHash(bytes)); }
private static byte[] GetHash(string input) { return(MD5Util.GetHash(input, new UTF8Encoding())); }