2014-12-13 19:56:14 +01:00
|
|
|
/**
|
|
|
|
* Browser version of the crypto for Bitmessage JS implementation.
|
|
|
|
* @module bitmessage/lib/crypto.browser
|
|
|
|
*/
|
2014-12-14 10:24:35 +01:00
|
|
|
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
exports.sha512 = function(buf) {
|
|
|
|
return window.crypto.subtle.digest({name: "SHA-512"}, buf).then(function(arr) {
|
|
|
|
return new Buffer(new Uint8Array(arr));
|
|
|
|
});
|
|
|
|
};
|