string-timing-safe-equal
v0.1.0
Published
crypto.timingSafeEqual, but works with strings
Downloads
1,411
Maintainers
Readme
string-timing-safe-equal
crypto.timingSafeEqual()
with two differences:
- Works with strings in addition to
Uint8Array
s andBuffer
s - Returns
false
when lengths are different (instead of throwing)
Usage:
import timingSafeEqual from "string-timing-safe-equal";
timingSafeEqual("abc", "abc");
// => true
timingSafeEqual("abc", "xyz");
// => false
timingSafeEqual("abc", "abcdefghi");
// => false