# crypt3

> Node.js crypt(3) bindings

Latest version **1.0.0** (published 2016-07-31) · MIT license · 0 weekly downloads

## Install

```sh
npm install crypt3
pnpm add crypt3
yarn add crypt3
bun add crypt3
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-07-31 |
| First published | 2013-08-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 20 |
| Author | Jaakko-Heikki Heusala |
| Maintainers | jhh |
| Keywords | crypt, password, md5, sha256, sha512, blowfish, hash |

## Links

- npm: https://www.npmjs.com/package/crypt3
- Repository: https://github.com/sendanor/node-crypt3
- Homepage: https://github.com/sendanor/node-crypt3#readme
- Issues: https://github.com/sendanor/node-crypt3/issues
- npm.io page: https://npm.io/package/crypt3

## Dependencies (2)

- [q](https://npm.io/package/q.md) ^1.0.1
- [nan](https://npm.io/package/nan.md) ^2.1.0

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-07-31
- 0.2.0 — 2015-11-07
- 0.1.8 — 2015-04-15
- 0.1.7 — 2015-02-15
- 0.1.6 — 2014-11-05
- 0.1.5 — 2014-06-27
- 0.1.4 — 2014-02-27
- 0.1.3 — 2014-02-07
- 0.1.2 — 2013-11-09
- 0.1.1 — 2013-08-05
- 0.1.0 — 2013-08-05

## README

node-crypt3
===========

[crypt3link]: https://en.wikipedia.org/wiki/Crypt_(C) "crypt() in C"

[crypt(3)][crypt3link] for Node.js

Installation
------------

Install using `npm install crypt3` and use:

### Promise version using [Q library](https://github.com/kriskowal/q)

```javascript
var crypt = require('crypt3/q');
```

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

### Async version

```javascript
var crypt = require('crypt3/async');
```

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

### Sync version

```javascript
var crypt = require('crypt3/sync');
```

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

#### Example password encoding

Use `crypt(key[, salt])`:

```javascript
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](http://sendanor.com/software).

---
_Source: https://npm.io/package/crypt3 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
