Esempio n. 1
0
 internal static string InteralCreateSignature(string raw)
 {
     using (var sha = new SHA1CryptoServiceProvider())
     {
         byte[] dataToHash = Encoding.ASCII.GetBytes(raw);
         byte[] dataHashed = sha.ComputeHash(dataToHash);
         string hash       = StringUtil.BinaryToHex(dataHashed, true);
         return(hash);
     }
 }
Esempio n. 2
0
        public static string Md5(string text)
        {
            TkDebug.AssertArgumentNullOrEmpty(text, "text", null);

            using (MD5 md5 = MD5.Create())
            {
                var result = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
                return(StringUtil.BinaryToHex(result, false));
            }
        }