zhanwencai 12d83acadd 更新支付回调 1 year ago
..
lib 12d83acadd 更新支付回调 1 year ago
test 12d83acadd 更新支付回调 1 year ago
.travis.yml 12d83acadd 更新支付回调 1 year ago
LICENSE 12d83acadd 更新支付回调 1 year ago
README.md 12d83acadd 更新支付回调 1 year ago
appveyor.yml 12d83acadd 更新支付回调 1 year ago
package.json 12d83acadd 更新支付回调 1 year ago

README.md

Timing safe string compare using double HMAC

Node.js Version npm NPM Downloads Build Status Build Status Dependency Status npm-license

Prevents timing attacks using Brad Hill's Double HMAC pattern to perform secure string comparison. Double HMAC avoids the timing atacks by blinding the timing channel using random time per attempt comparison against iterative brute force attacks.

Install

npm install tsscmp

Why

To compare secret values like authentication tokens, passwords or capability urls so that timing information is not leaked to the attacker.

Example

var timingSafeCompare = require('tsscmp');

var sessionToken = '127e6fbfe24a750e72930c';
var givenToken = '127e6fbfe24a750e72930c';

if (timingSafeCompare(sessionToken, givenToken)) {
  console.log('good token');
} else {
  console.log('bad token');
}

##License: MIT

Credits to: @jsha | @bnoordhuis | @suryagh |