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.
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();
$ deno test
secure-compare is released under the BSD 3 Clause license.