Socket
Socket
Sign inDemoInstall

scmp

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    scmp

safe, constant-time comparison of Buffers


Version published
Weekly downloads
1.3M
decreased by-0.36%
Maintainers
1
Install size
8.55 kB
Created
Weekly downloads
 

Changelog

Source

v2.1.0 (2019/12/26)

  • code now uses standard as linter
  • var has been replaced with const and let
  • code now executed in strict mode

Readme

Source

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

Keywords

FAQs

Last updated on 26 Dec 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc