Z User
phase7: MCP stdio smoke test (handshake + tools/list + get_roots 6:74) — 4/4 tests PASS
54a6341 Download node_modules/hono/dist/utils/crypto.js from bravesigma/quran-md-plugin: direct link, hf CLI and curl.
- Browser
- Download file 928 Bytes
-
https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/crypto.js
- Command line
-
hf download hf://datasets/bravesigma/quran-md-plugin/node_modules/hono/dist/utils/crypto.js
-
curl -L -o crypto.js https://huggingface.co/datasets/bravesigma/quran-md-plugin/resolve/main/node_modules/hono/dist/utils/crypto.js
928 Bytes
| //#region src/utils/crypto.ts | |
| const sha256 = async (data) => { | |
| return await createHash(data, { | |
| name: "SHA-256", | |
| alias: "sha256" | |
| }); | |
| }; | |
| const sha1 = async (data) => { | |
| return await createHash(data, { | |
| name: "SHA-1", | |
| alias: "sha1" | |
| }); | |
| }; | |
| const md5 = async (data) => { | |
| return await createHash(data, { | |
| name: "MD5", | |
| alias: "md5" | |
| }); | |
| }; | |
| const createHash = async (data, algorithm) => { | |
| let sourceBuffer; | |
| if (ArrayBuffer.isView(data) || data instanceof ArrayBuffer) sourceBuffer = data; | |
| else { | |
| if (typeof data === "object") data = JSON.stringify(data); | |
| sourceBuffer = new TextEncoder().encode(String(data)); | |
| } | |
| if (crypto && crypto.subtle) { | |
| const buffer = await crypto.subtle.digest({ name: algorithm.name }, sourceBuffer); | |
| return Array.prototype.map.call(new Uint8Array(buffer), (x) => ("00" + x.toString(16)).slice(-2)).join(""); | |
| } | |
| return null; | |
| }; | |
| //#endregion | |
| export { createHash, md5, sha1, sha256 }; | |