(bytes: ArrayBuffer)
| 22 | |
| 23 | /** Lowercase, zero-padded hex encoding of a byte buffer. */ |
| 24 | export function bytesToHex(bytes: ArrayBuffer): string { |
| 25 | return Array.from(new Uint8Array(bytes)) |
| 26 | .map((byte) => byte.toString(16).padStart(2, "0")) |
| 27 | .join(""); |
| 28 | } |
| 29 | |
| 30 | /** Salted SHA-256 hash of the full IP — irreversible without the salt. */ |
| 31 | export async function hashIp( |
no test coverage detected