wasSharpNET – Diff between revs 2 and 5
?pathlinks?
Rev 2 | Rev 5 | |||
---|---|---|---|---|
Line 3... | Line 3... | |||
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
3 | // Please see: http://www.gnu.org/licenses/gpl.html for legal details, // |
|
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
4 | // rights of fair usage, the disclaimer and warranty conditions. // |
|
5 | /////////////////////////////////////////////////////////////////////////// |
5 | /////////////////////////////////////////////////////////////////////////// |
|
Line 6... | Line 6... | |||
6 | |
6 | |
|
- | 7 | using System; |
||
Line 7... | Line 8... | |||
7 | using System; |
8 | using System.Text; |
|
8 | |
9 | |
|
9 | namespace wasSharpNET.Cryptography |
10 | namespace wasSharpNET.Cryptography |
|
10 | { |
11 | { |
|
Line 16... | Line 17... | |||
16 | /// <param name="sha1">the SHA1 hash object</param> |
17 | /// <param name="sha1">the SHA1 hash object</param> |
|
17 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data) |
18 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data) |
|
18 | { |
19 | { |
|
19 | return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
20 | return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
|
20 | } |
21 | } |
|
- | 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 | } |
||
21 | } |
27 | } |
|
22 | } |
28 | } |
|
23 | |
29 | |