auth/node_modules/scmp
Chandresh Kerkar 9dd376df76 Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
..
benchmark Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
lib Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
test Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
.travis.yml Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
HISTORY.md Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
LICENSE Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
README.md Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
index.js Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30
package.json Initial commit: Farm Auth Service with multi-device support and device management 2025-11-28 00:47:10 +05:30

README.md

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