bitmessage-js/lib/crypto.js
2014-12-18 19:47:18 +03:00

22 lines
473 B
JavaScript

/**
* Node.js version of the crypto for Bitmessage JS implementation.
* @module bitmessage/crypto
*/
"use strict";
require("es6-promise").polyfill();
var crypto = require("crypto");
exports.sha512 = function(buf) {
var hash = crypto.createHash("sha512");
hash.update(buf);
return Promise.resolve(hash.digest());
};
exports.ripemd160 = function(buf) {
var hash = crypto.createHash("ripemd160");
hash.update(buf);
return Promise.resolve(hash.digest());
};