blob: 92adb0c2e123ca96b0bf7b225c615f33419e3493 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
const { Hash } = require("./HashTypes.js");
// same output as node:crypto above (though now async).
async function createHash(...content) {
return Hash.create().toBase64Url(...content);
}
async function createHashHex(...content) {
return Hash.create().toHex(...content);
}
// Slower, but this feature does not require WebCrypto
function createHashSync(...content) {
return Hash.createSync().toBase64Url(...content);
}
function createHashHexSync(...content) {
return Hash.createSync().toHex(...content);
}
module.exports = {
createHash,
createHashSync,
createHashHex,
createHashHexSync,
};
|