本文整理汇总了C#中System.Security.Cryptography.MD5CryptoServiceProvider.Aggregate方法的典型用法代码示例。如果您正苦于以下问题:C# MD5CryptoServiceProvider.Aggregate方法的具体用法?C# MD5CryptoServiceProvider.Aggregate怎么用?C# MD5CryptoServiceProvider.Aggregate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.MD5CryptoServiceProvider
的用法示例。
在下文中一共展示了MD5CryptoServiceProvider.Aggregate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpMd5
/// <summary> MD5标准加密 </summary>
public static string SpMd5(string strVal)
{
string ret = string.Empty;
byte[] b = Encoding.UTF8.GetBytes(strVal);
b = new MD5CryptoServiceProvider().ComputeHash(b);
return b.Aggregate(ret, (current, t) => current + t.ToString("x").PadLeft(2, '0'));
}
示例2: ToMd5Fingerprint
public string ToMd5Fingerprint(string value)
{
var bytes = Encoding.Unicode.GetBytes(value.ToCharArray());
var hash = new MD5CryptoServiceProvider().ComputeHash(bytes);
// concat the hash bytes into one long string
return hash.Aggregate(new StringBuilder(32),
(sb, b) => sb.Append(b.ToString("X2")))
.ToString();
}
示例3: Encode
public static string Encode(string text)
{
//convert to char array
var chars = text.ToCharArray();
//get bytes from char array
var bytes = Encoding.Unicode.GetBytes(text.ToCharArray());
//get MD5 hash value
var hash = new MD5CryptoServiceProvider().ComputeHash(bytes);
//convert byte array into hashed string
return hash.Aggregate(new StringBuilder(32), (sb, b) => sb.Append(b.ToString("X2"))).ToString();
}
示例4: MD5Fingerprint
//MD5Fingerprint
string MD5Fingerprint(string s)
{
var bytes = Encoding.Unicode.GetBytes(s.ToCharArray());
var hash = new MD5CryptoServiceProvider().ComputeHash(bytes);
return hash.Aggregate(new StringBuilder(32), (sb, b) => sb.Append(b.ToString("X2"))).ToString();
}
示例5: MD5
/// <summary>
/// 标准MD5加密
/// </summary>
/// <param name="str">待加密的字符串</param>
/// <returns>加密后的字符串</returns>
public static string MD5(string str)
{
var b = Encoding.UTF8.GetBytes(str);
b = new MD5CryptoServiceProvider().ComputeHash(b);
return b.Aggregate("", (current, t) => current + t.ToString("x").PadLeft(2, '0'));
}
示例6: Md5
public static String Md5(String str) {
byte[] bytes = Encoding.UTF8.GetBytes(str);
bytes = new MD5CryptoServiceProvider().ComputeHash(bytes);
return bytes.Aggregate("", (current, t) => current + t.ToString("x").PadLeft(2, '0'));
}