Huge news!Announcing our $20M Series A led by Andreessen Horowitz.Learn more
Socket
Socket
Log inDemoInstall

buffer-equal-constant-time

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Issues
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

buffer-equal-constant-time

Constant-time comparison of Buffers

    1.0.1latest
    npm

Version published
Maintainers
1
Weekly downloads
13,661,294
decreased by-0.97%

Weekly downloads

Readme

Source

buffer-equal-constant-time

Constant-time Buffer comparison for node.js. Should work with browserify too.

Build Status

  npm install buffer-equal-constant-time

Usage

  var bufferEq = require('buffer-equal-constant-time');

  var a = new Buffer('asdf');
  var b = new Buffer('asdf');
  if (bufferEq(a,b)) {
    // the same!
  } else {
    // different in at least one byte!
  }

If you'd like to install an .equal() method onto the node.js Buffer and SlowBuffer prototypes:

  require('buffer-equal-constant-time').install();

  var a = new Buffer('asdf');
  var b = new Buffer('asdf');
  if (a.equal(b)) {
    // the same!
  } else {
    // different in at least one byte!
  }

To get rid of the installed .equal() method, call .restore():

  require('buffer-equal-constant-time').restore();

© 2013 GoInstant Inc., a salesforce.com company

Licensed under the BSD 3-clause license.

Keywords

FAQs

Last updated on 16 Dec 2013

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install
SocketSocket SOC 2 Logo

Product

  • Package Issues
  • 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