//private static void ForEach<T>(this IEnumerable<T> ie, Action<T> action) //{ // foreach (var i in ie) action(i); //} /// <summary> /// From: HashLib 2.1 (Dec 29, 2013) Stable /// http://hashlib.codeplex.com/ /// </summary> /// <param name="text"></param> /// <returns></returns> public static string SHA1(this string text) { var algo = new HashLib.Crypto.SHA1(); var res = algo.ComputeString(text, Encoding.UTF8); return(res.ToString().ToLower()); }
/// <summary> /// From: HashLib 2.1 (Dec 29, 2013) Stable /// http://hashlib.codeplex.com/ /// </summary> /// <param name="utf8Text"></param> /// <returns></returns> public static string SHA1ForUTF8(this string utf8Text) { if (utf8Text == null) { utf8Text = ""; } var algo = new HashLib.Crypto.SHA1(); var res = algo.ComputeString(utf8Text, Encoding.UTF8); return(res.ToString().ToLower()); }
/// <summary> /// From: HashLib 2.1 (Dec 29, 2013) Stable /// http://hashlib.codeplex.com/ /// </summary> /// <param name="text"></param> /// <returns></returns> public static string SHA1(this string text) { var algo = new HashLib.Crypto.SHA1(); var res = algo.ComputeString(text, Encoding.UTF8); return res.ToString().ToLower(); }