43 lines
965 B
Markdown
43 lines
965 B
Markdown
|
# apache-crypt
|
||
|
[Node.js](http://nodejs.org/) package for Apache style password encryption using crypt(3).
|
||
|
|
||
|
[![build](https://github.com/gevorg/apache-crypt/workflows/build/badge.svg)](https://github.com/gevorg/apache-crypt/actions/workflows/build.yml)
|
||
|
|
||
|
## Installation
|
||
|
|
||
|
Via git (or downloaded tarball):
|
||
|
|
||
|
```bash
|
||
|
$ git clone git://github.com/gevorg/apache-crypt.git
|
||
|
```
|
||
|
Via [npm](http://npmjs.org/):
|
||
|
|
||
|
```bash
|
||
|
$ npm install apache-crypt
|
||
|
```
|
||
|
|
||
|
## Usage
|
||
|
|
||
|
```javascript
|
||
|
const crypt = require("apache-crypt");
|
||
|
|
||
|
// Encrypting password using auto-generated 2 char salt.
|
||
|
const encryptedPassword = crypt("mypass");
|
||
|
|
||
|
// Should print true.
|
||
|
console.log(crypt("mypass", encryptedPassword) == encryptedPassword);
|
||
|
// Should print false.
|
||
|
console.log(crypt("notmypass", encryptedPassword) == encryptedPassword);
|
||
|
```
|
||
|
|
||
|
## Running tests
|
||
|
|
||
|
It uses [mocha](https://mochajs.org/), so just run following command in package directory:
|
||
|
|
||
|
```bash
|
||
|
$ npm test
|
||
|
```
|
||
|
|
||
|
## License
|
||
|
|
||
|
The MIT License (MIT)
|