0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/node_modules/crypt3
2014-09-14 18:37:21 +04:00
..
node_modules/nan added nan dep for crypt3 2014-09-14 18:37:21 +04:00
test importing all bundled deps to git 2014-09-14 18:28:17 +04:00
.gitignore importing all bundled deps to git 2014-09-14 18:28:17 +04:00
binding.gyp importing all bundled deps to git 2014-09-14 18:28:17 +04:00
crypt3.cc importing all bundled deps to git 2014-09-14 18:28:17 +04:00
index.js importing all bundled deps to git 2014-09-14 18:28:17 +04:00
LICENSE importing all bundled deps to git 2014-09-14 18:28:17 +04:00
package.json importing all bundled deps to git 2014-09-14 18:28:17 +04:00
README.md importing all bundled deps to git 2014-09-14 18:28:17 +04:00

node-crypt3

crypt(3) for Node.js

Installation

Install using npm install crypt3 and use:

var crypt = require('crypt3');

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).