No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zebulon McCorkle 5f484cda8d
Add me to uploaders
11 months ago
debian Add me to uploaders 11 months ago
test Asynchronous version 2 years ago
.gitignore Added initial files 5 years ago
.travis.yml Configure Travis CI testing 3 years ago
LICENSE Added initial files 5 years ago
README.md Added note about Windows support 2 years ago
async.js Asynchronous version 2 years ago
binding.gyp Asynchronous version 2 years ago
createsalt.js Asynchronous version 2 years ago
crypt3.cc Configure Travis CI testing 3 years ago
crypt3async.cc Asynchronous version 2 years ago
index.js Asynchronous version 2 years ago
package.json Was not published yet, so back to 1.0.0 2 years ago
q.js Asynchronous version 2 years ago
sync.js Asynchronous version 2 years ago

README.md

node-crypt3

crypt(3) for Node.js

Installation

Install using npm install crypt3 and use:

Promise version using Q library

var crypt = require('crypt3/q');
crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/').then(function(value) {
	if( value !== '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/' ) {
		console.error('Access denied!');
		return;
	}
}).fail(function(err) {
	...
});

Async version

var crypt = require('crypt3/async');
crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/', function(err, value) {
	if(err) {
		...
		return;
	}
	if( value !== '$1$SrkubyRm$DEQU3KupUxt4yfhbK1HyV/' ) {
		console.error('Access denied!');
		return;
	}
});

Sync version

var crypt = require('crypt3/sync');
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, glibc2 only
console.log( crypt('6Xz7sS6fEmnWScMb6Ayf363e5cdqF4Kh', crypt.createSalt('sha512') ) );      // SHA-512, glibc2 only

Create hashes

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

Please note that this library does not work on Windows, and usually has a limited functionality on other *NIX systems other than Linux.

Commercial Support

You can buy commercial support from Sendanor.