wasSharpNET – Blame information for rev 5

Subversion Repositories:
Rev:
Rev Author Line No. Line
2 office 1 ///////////////////////////////////////////////////////////////////////////
2 // Copyright (C) Wizardry and Steamworks 2016 - License: GNU GPLv3 //
3 // Please see: http://www.gnu.org/licenses/gpl.html for legal details, //
4 // rights of fair usage, the disclaimer and warranty conditions. //
5 ///////////////////////////////////////////////////////////////////////////
6  
7 using System;
5 office 8 using System.Text;
2 office 9  
10 namespace wasSharpNET.Cryptography
11 {
12 public static class SHA1
13 {
14 /// <summary>
15 /// Return a 40 character hex representation of a SHA1 hash.
16 /// </summary>
17 /// <param name="sha1">the SHA1 hash object</param>
18 public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data)
19 {
20 return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", "");
21 }
5 office 22  
23 public static string ToHex(this System.Security.Cryptography.SHA1 sha1, string data)
24 {
25 return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(data))).Replace("-", "");
26 }
2 office 27 }
28 }