how to compare hexadecimal hash, generated by 'createhash' in typescript

index.ts
import { createHash } from 'crypto';

// Generate hashes for comparison
const hash1 = createHash('sha256').update('hello').digest('hex');
const hash2 = createHash('sha256').update('hello').digest('hex');

// Compare hashes
if (hash1 === hash2) {
    console.log('Hashes are equal');
} else {
    console.log('Hashes are not equal');
}
335 chars
13 lines

gistlibby LogSnag