Compares two strings/buffers using the same time whether they're equal or not.
This function is useful to mitigate timing attacks; for instance, when testing
crypto password hashes.
Note: Both arguments must be of the same length to be compared successfully.
When arguments of differing length are supplied,
false is returned immediately and the length of the known string may be leaked in case of a timing attack.
But in most cases size and algorithm choice are not secret.
npm i -S crypt-equals
const cryptEq = ;const hash1 = 'LVYtSUvPsB7BRR3m6T5DXKLD-fTsb7K5tu1-bt1QjT8';const hash2 = 'LVYtSUvPsB7BRR3m6T5DXKLD-fTsb7K5tu1-bt1QjT8';ifconsole;elseconsole;// Supports Buffer as wellconst buf1 = Buffer;const buf2 = Buffer;ifconsole;elseconsole;