mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
8 lines
283 B
JavaScript
8 lines
283 B
JavaScript
|
|
var shim = require('./shim');
|
|
module.exports = async function(d, o){
|
|
var t = (typeof d == 'string')? d : JSON.stringify(d);
|
|
var hash = await shim.subtle.digest({name: o||'SHA-256'}, new shim.TextEncoder().encode(t));
|
|
return shim.Buffer.from(hash);
|
|
}
|
|
|