Neanderthal Painting Monet

    tsscmp
    DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/tsscmp package

    1.0.6 • Public • Published

    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 |

    Install

    npm i tsscmp

    DownloadsWeekly Downloads

    2,644,720

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    8.36 kB

    Total Files

    8

    Last publish

    Collaborators

    • suryagh