jsnode crypto createHmac & createHash

andre via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Nov 28 04:46:25 PST 2014


Hi,

I translate some functionality written in jsnode,
which contains a crypto library.

Although there is some sha256 support in
phobos I think, they do not provide all functionality
I need to translate following two functions.
(Input and output is ubyte[])

Is there a library which supports the methods
similiar (createHmac, update)... ?

function hmac(key, msg) {
   var hash = crypto.createHmac('sha256', key);
   hash.update(msg);
   return new Buffer(hash.digest(), 'binary');
}

function sha256(msg) {
   var hash = crypto.createHash('sha256');
   hash.update(msg);
   return new Buffer(hash.digest(), 'binary');
}

Kind regards
André


More information about the Digitalmars-d-learn mailing list