the editable site (validation-lab)

This commit is contained in:
kpgarrod committed 2026-11-21 08:03:55 +01:00
commit 3ac81d5a52
13454 files changed
+2227005

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
/**
* Hashes a string using the SHA-256 algorithm and encodes it in Base64URL format.
*
* @param {string} data - data message to hash.
*
* @returns {string} The hash of the data.
*/
declare function digest(data: string): string;
export { digest };
+10
View File
@@ -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 };