bitmessage-js/lib/crypto.js
2014-12-13 21:56:14 +03:00

17 lines
383 B
JavaScript

/**
* Node.js version of the crypto for Bitmessage JS implementation.
* Wrap all crypto functions with promises because WebCryptoAPI uses it
* throughout.
* @module bitmessage/lib/crypto
*/
"use strict";
var crypto = require("crypto");
exports.sha512 = function(buf) {
var hash = crypto.createHash("sha512");
hash.update(buf);
return Promise.resolve(hash.digest());
};