scmp

time-equivalent string-comparison function

scmp v2 uses improved core crypto comparison since Node v6.6.0
Last updated 14 years ago by freewil .
BSD · Repository · Original npm · Tarball · package.json
$ npm install scmp 
SYNC missed versions from official npm registry.

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');
}

Current Tags

  • 2.1.0                                ...           latest (7 years ago)

8 Versions

  • 2.1.0 [deprecated]           ...           7 years ago
  • 2.0.0 [deprecated]           ...           10 years ago
  • 1.0.2 [deprecated]           ...           10 years ago
  • 1.0.1 [deprecated]           ...           10 years ago
  • 1.0.0 [deprecated]           ...           12 years ago
  • 0.0.3 [deprecated]           ...           13 years ago
  • 0.0.2 [deprecated]           ...           14 years ago
  • 0.0.1 [deprecated]           ...           14 years ago
Maintainers (1)
Downloads
Total 36
Today 0
This Week 4
This Month 22
Last Day 0
Last Week 7
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE