mirror of
https://github.com/koala73/worldmonitor.git
synced 2026-04-25 17:14:57 +02:00
9 lines
288 B
TypeScript
9 lines
288 B
TypeScript
import { createHash, timingSafeEqual as cryptoTimingSafeEqual } from 'node:crypto';
|
|
|
|
export function timingSafeEqual(a: string, b: string): boolean {
|
|
const h = (s: string) => createHash('sha256').update(s).digest();
|
|
return cryptoTimingSafeEqual(h(a), h(b));
|
|
}
|
|
|
|
export { createHash };
|