This is simple libraries that compute hash from a string. It is implemented in COM (32/64 bits) and C#.

The input string is converted into UTF-8, and then is hashed by a hash algorithm such as MD5, SHA2-256, etc. The hashed binary is encoded by Base64.

The following code is an example of using the string hasher in C#. The StringHasher class is implemented in the StringHasher.cs file.

 *  C#
using Ryeol.Security.Cryptography;

// Creates an instance.
StringHasher hasher = new StringHasher();

// Sets the hash algorithm.
// MD5, SHA1, SHA2-256, SHA2-384, SHA2-512 are supported.
hasher.Algorithm = StringHasherAlgorithm.SHA2_256;

// Hashs a string.
string hashed = hasher.Compute("Test sample");

The following code shows how to use the string hasher in ASP(VBScript). Since ASP doesn't support built-in hash algorithm, you need to install the RyeolStringHasher.dll file which is a COM dll based on XySSL 0.8.
(You also need to install the Visual C++ Redistributable for Visual Studio 2012.)

'  ASP (VBScript)
' Creates an instance.
Set objHasher = Server.CreateObject("Ryeol.StringHasher")

' Sets the hash algorithm.
' MD2, MD4, MD5, SHA1, SHA2-224, SHA2-256, SHA2-384, SHA2-512 are supported.
objHasher.Algorithm = "SHA2-256"

' Hashs a string.
strHashed = objHasher.Compute("Test sample")

Release Note

June 7, 2013
The C# StringHasher has changed to create a hash implementation by using the Create method to support Windows XP.

December 10, 2012
Initial release.


티스토리 툴바