System.Security.Cryptography.SHA1.Create C# (CSharp) Method

Create() private method

private Create ( ) : SHA1
return SHA1
        public static new SHA1 Create()
        {
            return new Implementation();
        }

Same methods

SHA1::Create ( string hashName ) : SHA1

Usage Example

Beispiel #1
0
        /// <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);
        }
All Usage Examples Of System.Security.Cryptography.SHA1::Create