Buckets:
| import { timingSafeEqual } from "node:crypto" | |
| export function generateUnbiasedDigits(length: number): string { | |
| const result: number[] = [] | |
| 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("") | |
| } | |
| export function timingSafeCompare(a: string, b: string): boolean { | |
| if (typeof a !== "string" || typeof b !== "string") { | |
| return false | |
| } | |
| if (a.length !== b.length) { | |
| return false | |
| } | |
| return timingSafeEqual(Buffer.from(a), Buffer.from(b)) | |
| } | |
Xet Storage Details
- Size:
- 662 Bytes
- Xet hash:
- 99e8af4c307d0695e13291e5c4d0b409831767c341f73792a9c7aae76e47dac9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.