wasSharpNET
/Cryptography/SHA1.cs |
@@ -17,16 +17,32 @@ |
/// Return a 40 character hex representation of a SHA1 hash. |
/// </summary> |
/// <param name="sha1">the SHA1 hash object</param> |
/// <param name="data">the byte data to compute the hash from</param> |
public static string ToHex(this System.Security.Cryptography.SHA1 sha1, byte[] data) |
{ |
return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
} |
|
/// <summary> |
/// Return a 40 character hex representation of a SHA1 hash. |
/// </summary> |
/// <param name="sha1">the SHA1 hash object</param> |
/// <param name="data">the string data to compute the hash from</param> |
public static string ToHex(this System.Security.Cryptography.SHA1 sha1, string data) |
{ |
return BitConverter.ToString(sha1.ComputeHash(Encoding.UTF8.GetBytes(data))).Replace("-", ""); |
} |
|
/// <summary> |
/// Return a 40 character hex representation of a SHA1 hash. |
/// </summary> |
/// <param name="sha1">the SHA1 hash object</param> |
/// <param name="data">the memorystream to compute the hash from</param> |
public static string ToHex(this System.Security.Cryptography.SHA1 sha1, MemoryStream data) |
{ |
return BitConverter.ToString(sha1.ComputeHash(data)).Replace("-", ""); |
} |
|
/////////////////////////////////////////////////////////////////////////// |
// Copyright (C) Wizardry and Steamworks 2014 - License: GNU GPLv3 // |
/////////////////////////////////////////////////////////////////////////// |