scmp

safe, constant-time comparison of Buffers

BSD-3-Clause 8 个版本
安装
npm install scmp
yarn add scmp
pnpm add scmp
bun add scmp
README

scmp

travis npm downloads

Safe, constant-time comparison of Buffers.

Install

npm install scmp

Why?

To minimize vulnerability against timing attacks.

Example

const scmp = require('scmp');
const Buffer = require('safe-buffer').Buffer;

const hash      = Buffer.from('e727d1464ae12436e899a726da5b2f11d8381b26', 'hex');
const givenHash = Buffer.from('e727e1b80e448a213b392049888111e1779a52db', 'hex');

if (scmp(hash, givenHash)) {
  console.log('good hash');
} else {
  console.log('bad hash');
}

版本列表
2.1.0 2019-12-26
2.0.0 2016-11-06
1.0.2 2016-11-06
1.0.1 2016-11-03
1.0.0 2014-11-04
0.0.3 2014-03-24
0.0.2 2013-02-12
0.0.1 2013-02-11