![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | lib/ | 2 years ago | - | |
![]() | test/ | 2 years ago | - | |
![]() | LICENSE | 40 years ago | 1.1K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
![]() | README.md | 40 years ago | 1.9K | f12eb36 documentaiton updates [كارل مبارك] |
![]() | appveyor.yml | 40 years ago | 715 | |
![]() | package.json | 2 years ago | 1.5K | 7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك] |
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.
npm install tsscmp
To compare secret values like authentication tokens, passwords or capability urls so that timing information is not leaked to the attacker.
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 |