2.1.1 • Published 1 year ago

compare-timing-safe v2.1.1

Weekly downloads
89
License
Unlicense
Repository
github
Last release
1 year ago

NPM version Build Status

compare-timing-safe

String comparison in length constant time

Works in node and in the browser.

Node version uses crypto module.

timingSafeEqual(a, b)

String, buffer comparison in length-constant time

Example

import timingSafeEqual from 'compare-timing-safe'
const input = 'a'
const compareWith = 'bbbbbbbb'
timingSafeEqual(input, compareWith)
//> false

Parameters

parametertypedescription
aString, BufferString or buffer from input
bString, BufferString or buffer to compare with a

Returns Boolean, true if strings match

Installation

Requires nodejs.

$ npm install compare-timing-safe

Tests

$ npm test

License

Unlicense https://unlicense.org

References