# scmp

> safe, constant-time comparison of Buffers

Latest version **2.1.0** (published 2019-12-26) · BSD-3-Clause license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install scmp
pnpm add scmp
yarn add scmp
bun add scmp
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 2.1.0 |
| Published | 2019-12-26 |
| First published | 2013-02-11 |
| Weekly downloads | 0 |
| License | BSD-3-Clause |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 49 |
| Author | Sean Lavine |
| Maintainers | freewil |
| Keywords | safe-compare, compare, time-equivalent-comparison, time equivalent, constant-time, constant time |

## Links

- npm: https://www.npmjs.com/package/scmp
- Repository: https://github.com/freewil/scmp
- Homepage: https://github.com/freewil/scmp#readme
- Issues: https://github.com/freewil/scmp/issues
- npm.io page: https://npm.io/package/scmp

## Recent versions

- 2.1.0 (latest) — 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

## README

# scmp
[![travis][travis-image]][travis-url]
[![npm][npm-image]][npm-url]
[![downloads][downloads-image]][downloads-url]

[travis-image]: https://travis-ci.org/freewil/scmp.svg?branch=master
[travis-url]: https://travis-ci.org/freewil/scmp

[npm-image]: https://img.shields.io/npm/v/scmp.svg?style=flat
[npm-url]: https://npmjs.org/package/scmp

[downloads-image]: https://img.shields.io/npm/dm/scmp.svg?style=flat
[downloads-url]: https://npmjs.org/package/scmp

Safe, constant-time comparison of Buffers.

## Install

```
npm install scmp
```

## Why?

To minimize vulnerability against [timing attacks](http://codahale.com/a-lesson-in-timing-attacks/).

## Example

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

```

---
_Source: https://npm.io/package/scmp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
