bitmessage-js/lib/platform.js
Kagami Hiiragi bf8b663c5d Do not use promises in crypto
Because sha.js is faster than WebCryptoAPI for POW.
2015-01-03 17:52:27 +03:00

23 lines
465 B
JavaScript

/**
* Node.js implementation of platform-specific routines.
*/
"use strict";
var crypto = require("crypto");
var createHash = crypto.createHash;
exports.sha512 = function(buf) {
return createHash("sha512").update(buf).digest();
};
exports.sha256 = function(buf) {
return createHash("sha256").update(buf).digest();
};
exports.ripemd160 = function(buf) {
return createHash("ripemd160").update(buf).digest();
};
exports.randomBytes = crypto.randomBytes;