fuc-new/doc/node_modules/secure-compare
2025-10-15 12:40:55 +08:00
..
.npmignore 1 2025-10-03 17:17:08 +08:00
index.js 1 2025-10-03 17:17:08 +08:00
package.json 1 2025-10-03 17:17:08 +08:00
README.md no message 2025-10-15 12:40:55 +08:00
test.js 1 2025-10-03 17:17:08 +08:00

secure-compare

Constant-time comparison algorithm to prevent timing attacks for Node.js. Copied from cryptiles by C J Silverio.

Installation

$ npm install secure-compare --save

Usage

var compare = require('secure-compare');

compare('hello world', 'hello world').should.equal(true);
compare('你好世界', '你好世界').should.equal(true);

compare('hello', 'not hello').should.equal(false);

Tests

$ npm test

License

secure-compare is released under the MIT license.