Buckets:
ktongue/docker_container / .cache /opencode /node_modules /@openauthjs /openauth /dist /esm /random.js
| // src/random.ts | |
| import { timingSafeEqual } from "node:crypto"; | |
| function generateUnbiasedDigits(length) { | |
| const result = []; | |
| while (result.length < length) { | |
| const buffer = crypto.getRandomValues(new Uint8Array(length * 2)); | |
| for (const byte of buffer) { | |
| if (byte < 250 && result.length < length) { | |
| result.push(byte % 10); | |
| } | |
| } | |
| } | |
| return result.join(""); | |
| } | |
| function timingSafeCompare(a, b) { | |
| if (typeof a !== "string" || typeof b !== "string") { | |
| return false; | |
| } | |
| if (a.length !== b.length) { | |
| return false; | |
| } | |
| return timingSafeEqual(Buffer.from(a), Buffer.from(b)); | |
| } | |
| export { | |
| timingSafeCompare, | |
| generateUnbiasedDigits | |
| }; | |
Xet Storage Details
- Size:
- 678 Bytes
- Xet hash:
- e66a87b094772d9394d5f9b22e34fc95a58b66a5a64919611e8f072dcf6aa36a
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.