Пример #1
0
        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("-", ""));
        }
Пример #2
0
 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));
 }
Пример #3
0
 private static byte[] GetHash(string input)
 {
     return(MD5Util.GetHash(input, new UTF8Encoding()));
 }