crypt3-prebuilt

0.1.7 • Public • Published

crypt3-prebuilt

crypt(3) for Node.js

travis badge Installation

Install using npm install crypt3-prebuilt and use:

var crypt = require('crypt3-prebuilt');

Example password check

if( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/') !== '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/' ) {
    console.error('Access denied!');
    return;
}

Example password encoding

Use crypt(key[, salt]):

console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh') );                                   // Salt generated automatically using default SHA512
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('md5') ) );         // MD5 salt
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('blowfish') ) );    // Blowfish salt (only some Linux distros)
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha256') ) );      // SHA-256
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha512') ) );      // SHA-512

Create hashes

Use crypt.createSalt([type=sha512]) where type is one of md5, blowfish, sha256 or sha512 (default).

Dependencies (2)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i crypt3-prebuilt

    Weekly Downloads

    0

    Version

    0.1.7

    License

    MIT

    Last publish

    Collaborators

    • rnbwd