You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

crypt3

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypt3

Node.js crypt(3) bindings

1.0.0
latest
Source
npmnpm
Version published
Weekly downloads
76
-58.47%
Maintainers
1
Weekly downloads
 
Created
Source

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

Commercial Support

You can buy commercial support from Sendanor.

Keywords

crypt

FAQs

Package last updated on 31 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts