test
This commit is contained in:
20
node_modules/apache-crypt/LICENSE
generated
vendored
Normal file
20
node_modules/apache-crypt/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Gevorg Harutyunyan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
43
node_modules/apache-crypt/README.md
generated
vendored
Normal file
43
node_modules/apache-crypt/README.md
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# apache-crypt
|
||||
[Node.js](http://nodejs.org/) package for Apache style password encryption using crypt(3).
|
||||
|
||||
[](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)
|
||||
53
node_modules/apache-crypt/package.json
generated
vendored
Normal file
53
node_modules/apache-crypt/package.json
generated
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "apache-crypt",
|
||||
"description": "Node.js module for Apache style password encryption using crypt(3).",
|
||||
"version": "1.2.6",
|
||||
"author": "Gevorg Harutyunyan (http://github.com/gevorg)",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "gevorg",
|
||||
"email": "gevorg.ha@gmail.com"
|
||||
}
|
||||
],
|
||||
"homepage": "http://github.com/gevorg/apache-crypt",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "http://github.com/gevorg/apache-crypt.git"
|
||||
},
|
||||
"main": "./src/index.js",
|
||||
"licenses": [
|
||||
{
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/gevorg/apache-crypt/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "http://github.com/gevorg/apache-crypt/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"unix-crypt-td-js": "^1.1.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^4.2.0",
|
||||
"eslint": "^6.8.0",
|
||||
"eslint-config-prettier": "^6.10.0",
|
||||
"eslint-plugin-node": "^11.0.0",
|
||||
"eslint-plugin-prettier": "^3.1.2",
|
||||
"mocha": "^7.0.1",
|
||||
"prettier": "^1.19.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha",
|
||||
"pretest": "eslint --ignore-path .gitignore ."
|
||||
},
|
||||
"keywords": [
|
||||
"apache",
|
||||
"crypt",
|
||||
"password",
|
||||
"htpasswd"
|
||||
]
|
||||
}
|
||||
20
node_modules/apache-crypt/src/index.js
generated
vendored
Normal file
20
node_modules/apache-crypt/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
// Des module.
|
||||
const des = require("unix-crypt-td-js");
|
||||
|
||||
// Hash generation string.
|
||||
const itoa64 =
|
||||
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
// Salt generation method.
|
||||
function getSalt() {
|
||||
return (
|
||||
itoa64[parseInt(Math.random() * 64)] + itoa64[parseInt(Math.random() * 64)]
|
||||
);
|
||||
}
|
||||
|
||||
// Exporting old style.
|
||||
module.exports = (password, salt) => {
|
||||
return salt ? des(password, salt) : des(password, getSalt());
|
||||
};
|
||||
Reference in New Issue
Block a user