bitmessage-js/lib/crypto.js

22 lines
473 B
JavaScript
Raw Normal View History

2014-12-13 19:56:14 +01:00
/**
* Node.js version of the crypto for Bitmessage JS implementation.
2014-12-18 17:47:18 +01:00
* @module bitmessage/crypto
2014-12-13 19:56:14 +01:00
*/
"use strict";
2014-12-18 17:47:18 +01:00
require("es6-promise").polyfill();
2014-12-13 19:56:14 +01:00
var crypto = require("crypto");
exports.sha512 = function(buf) {
var hash = crypto.createHash("sha512");
hash.update(buf);
return Promise.resolve(hash.digest());
};
2014-12-18 17:47:18 +01:00
exports.ripemd160 = function(buf) {
var hash = crypto.createHash("ripemd160");
hash.update(buf);
return Promise.resolve(hash.digest());
};