17 lines
383 B
JavaScript
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());
|
||
|
};
|