/// <summary> /// 哈希算法 /// </summary> /// <param name="source">源字符串</param> /// <returns>string</returns> public static string SHA1(string source) { var result = string.Empty; try { var bytes = SysSH1.Create().ComputeHash(Encoding.UTF8.GetBytes(source)); var sb = new StringBuilder(); foreach (var item in bytes) { sb.Append(item.ToString("x2")); } result = sb.ToString().ToUpper(); } catch (Exception ex) { LogHelper.Error(ex, "哈希算法"); } return(result); }
/// <summary>Creates an instance of the default implementation of <see cref="T:System.Security.Cryptography.SHA1" />.</summary> /// <returns>A new instance of <see cref="T:System.Security.Cryptography.SHA1" />.</returns> // Token: 0x06002344 RID: 9028 RVA: 0x0007FCC0 File Offset: 0x0007DEC0 public new static SHA1 Create() { return(SHA1.Create("System.Security.Cryptography.SHA1")); }