string-timing-safe-equal
v0.1.0
Published
crypto.timingSafeEqual, but works with strings
Downloads
771
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