the editable site (validation-lab)
This commit is contained in:
commit
3ac81d5a52
13454 files changed
+2227005
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
import { createHash } from "node:crypto";
|
||||
const fastHash = /*@__PURE__*/ (() => globalThis.process?.getBuiltinModule?.("crypto")?.hash)();
|
||||
const algorithm = "sha256";
|
||||
const encoding = "base64url";
|
||||
function digest(data) {
|
||||
if (fastHash) return fastHash(algorithm, data, encoding);
|
||||
const h = createHash(algorithm).update(data);
|
||||
return globalThis.process?.versions?.webcontainer ? h.digest().toString(encoding) : h.digest(encoding);
|
||||
}
|
||||
export { digest };
|
||||
Reference in new issue
Block a user