wasSharpNET – Diff between revs 11 and 13
?pathlinks?
Rev 11 | Rev 13 | |||
---|---|---|---|---|
Line 15... | Line 15... | |||
15 | { |
15 | { |
|
16 | /// <summary> |
16 | /// <summary> |
|
17 | /// Return a 40 character hex representation of a SHA1 hash. |
17 | /// Return a 40 character hex representation of a SHA1 hash. |
|
18 | /// </summary> |
18 | /// </summary> |
|
19 | /// <param name="sha1">the SHA1 hash object</param> |
19 | /// <param name="sha1">the SHA1 hash object</param> |
|
- | 20 | /// <param name="data">the byte data to compute the hash from</param> |
||
20 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data) |
21 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data) |
|
21 | { |
22 | { |
|
22 | return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
23 | return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
|
23 | } |
24 | } |
|
Line -... | Line 25... | |||
- | 25 | |
||
- | 26 | /// <summary> |
||
- | 27 | /// Return a 40 character hex representation of a SHA1 hash. |
||
- | 28 | /// </summary> |
||
- | 29 | /// <param name="sha1">the SHA1 hash object</param> |
||
24 | |
30 | /// <param name="data">the string data to compute the hash from</param> |
|
25 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, string data) |
31 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, string data) |
|
26 | { |
32 | { |
|
27 | return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(data))).Replace("-", ""); |
33 | return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(data))).Replace("-", ""); |
|
Line -... | Line 34... | |||
- | 34 | } |
||
- | 35 | |
||
- | 36 | /// <summary> |
||
- | 37 | /// Return a 40 character hex representation of a SHA1 hash. |
||
- | 38 | /// </summary> |
||
- | 39 | /// <param name="sha1">the SHA1 hash object</param> |
||
- | 40 | /// <param name="data">the memorystream to compute the hash from</param> |
||
- | 41 | public static string ToHex(this System.Security.Cryptography.SHA1 sha1, MemoryStream data) |
||
- | 42 | { |
||
- | 43 | return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
||
28 | } |
44 | } |
|
29 | |
45 | |
|
30 | /////////////////////////////////////////////////////////////////////////// |
46 | /////////////////////////////////////////////////////////////////////////// |
|
31 | // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
47 | // Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
|
32 | /////////////////////////////////////////////////////////////////////////// |
48 | /////////////////////////////////////////////////////////////////////////// |