Node.js
Node.js
Workaround for the deprecated Crypt2.HashString method
Shows how to replace the deprecated HashString method. (Chilkat is moving away from the use of CkByteData.)Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var crypt = new chilkat.Crypt2();
crypt.Charset = "utf-8";
crypt.HashAlgorithm = "sha256";
var inputStr = "This is a test.";
// ------------------------------------------------------------------------
// The HashString method is deprecated:
outData = crypt.HashString(inputStr);
// ------------------------------------------------------------------------
// Workaround.
// (Chilkat is moving away from using CkByteData)
crypt.EncodingMode = "base64";
var hash_base64 = crypt.HashStringENC(inputStr);
console.log(hash_base64);
}
chilkatExample();