secure-compare

Constant-time comparison algorithm to prevent timing attacks for Node.js Deno. Copied from cryptiles by C J Silverio and from secure-compare by Vadim Demedes.

Usage

import secureCompare from "https://denopkg.com/hkatzdev/secure-compare/mod.ts";

if (!secureCompare('hello world', 'hello world')) throw Error();

if (!secureCompare('你好世界', '你好世界')) throw Error();

if (secureCompare('hello', 'not hello')) throw Error();

Run on Repl.it

Tests

$ deno test

License

secure-compare is released under the BSD 3 Clause license.