Hash algorithms operate on bytes. Input bytes are hashed to produce a constant-length binary output. When hashing strings, you should be aware of the underlying character encoding of the string being hashed, because it affects the bytes presented to the hash algorithm.
For example, strings are always passed to an ActiveX as Unicode (2 bytes/char). Is your intention to hash the Unicode encoding of the character string, or a 1-byte/char encoding such as iso-8859-1 or windows-1252?
This can be controlled by setting the Charset property of the ChilkatCrypt2 component. For example:
Dim crypt As New ChilkatCrypt2
crypt.UnlockComponent "UnlockCode"
crypt.HashAlgorithm = "md5"
crypt.EncodingMode = "base64"
' Hash the iso-8859-1 representation of the string (2 bytes/char)
crypt.Charset = "iso-8859-1"
Text1.Text = crypt.HashStringENC("123456")
' Output is 4QrcOUm6Wau+VuBX8g+IPg==
' Hash the Unicode representation of the string (2 bytes/char)
crypt.Charset = "Unicode"
Text2.Text = crypt.HashStringENC("123456")
' Output is zgv9FQWbaNZ2iIhNej0+jA==
Here is the equivalent C# code:
Chilkat.Crypt2 crypt = new Chilkat.Crypt2();
crypt.UnlockComponent("test");
crypt.HashAlgorithm = "md5";
crypt.EncodingMode = "base64";
// Output is 4QrcOUm6Wau+VuBX8g+IPg== (i.e. we are hashing 1 byte/char)
MessageBox.Show(crypt.HashStringENC("123456"));
// Output is zgv9FQWbaNZ2iIhNej0+jA== (we are now hashing 2 bytes/char)
crypt.Charset = "Unicode";
MessageBox.Show(crypt.HashStringENC("123456"));