Current Folder

This commit is contained in:
Luis Fernando Molina committed 2020-11-20 14:05:59 +01:00
1 parent 8b3382289b
commit cfcada880d
4379 files changed

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
var Buffer = require('safe-buffer').Buffer
var MD5 = require('md5.js')
/* eslint-disable camelcase */
function EVP_BytesToKey (password, salt, keyBits, ivLen) {
if (!Buffer.isBuffer(password)) password = Buffer.from(password, 'binary')
if (salt) {
if (!Buffer.isBuffer(salt)) salt = Buffer.from(salt, 'binary')
if (salt.length !== 8) throw new RangeError('salt should be Buffer with 8 byte length')
}
var keyLen = keyBits / 8
var key = Buffer.alloc(keyLen)
var iv = Buffer.alloc(ivLen || 0)
var tmp = Buffer.alloc(0)
while (keyLen > 0 || ivLen > 0) {
var hash = new MD5()
hash.update(tmp)
hash.update(password)
if (salt) hash.update(salt)
tmp = hash.digest()
var used = 0
if (keyLen > 0) {
var keyStart = key.length - keyLen
used = Math.min(keyLen, tmp.length)
tmp.copy(key, keyStart, 0, used)
keyLen -= used
}
if (used < tmp.length && ivLen > 0) {
var ivStart = iv.length - ivLen
var length = Math.min(ivLen, tmp.length - used)
tmp.copy(iv, ivStart, used, used + length)
ivLen -= length
}
}
tmp.fill(0)
return { key: key, iv: iv }
}
module.exports = EVP_BytesToKey
+78
View File
@@ -0,0 +1,78 @@
{
"_from": "evp_bytestokey@^1.0.0",
"_id": "evp_bytestokey@1.0.3",
"_inBundle": false,
"_integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==",
"_location": "/evp_bytestokey",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "evp_bytestokey@^1.0.0",
"name": "evp_bytestokey",
"escapedName": "evp_bytestokey",
"rawSpec": "^1.0.0",
"saveSpec": null,
"fetchSpec": "^1.0.0"
},
"_requiredBy": [
"/browserify-aes",
"/browserify-cipher",
"/parse-asn1"
],
"_resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz",
"_shasum": "7fcbdb198dc71959432efe13842684e0525acb02",
"_spec": "evp_bytestokey@^1.0.0",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\browserify-cipher",
"author": {
"name": "Calvin Metcalf",
"email": "calvin.metcalf@gmail.com"
},
"bugs": {
"url": "https://github.com/crypto-browserify/EVP_BytesToKey/issues"
},
"bundleDependencies": false,
"contributors": [
{
"name": "Kirill Fomichev",
"email": "fanatid@ya.ru"
}
],
"dependencies": {
"md5.js": "^1.3.4",
"safe-buffer": "^5.1.1"
},
"deprecated": false,
"description": "The insecure key derivation algorithm from OpenSSL",
"devDependencies": {
"bindings": "^1.2.1",
"nan": "^2.4.0",
"nyc": "^8.1.0",
"standard": "^8.0.0",
"tape": "^4.6.0"
},
"files": [
"index.js"
],
"gypfile": false,
"homepage": "https://github.com/crypto-browserify/EVP_BytesToKey",
"keywords": [
"crypto",
"openssl"
],
"license": "MIT",
"main": "index.js",
"name": "evp_bytestokey",
"repository": {
"type": "git",
"url": "git+https://github.com/crypto-browserify/EVP_BytesToKey.git"
},
"scripts": {
"coverage": "nyc tape test/*.js",
"lint": "standard",
"test": "npm run lint && npm run unit",
"test:prepare": "node-gyp rebuild",
"unit": "tape test/*.js"
},
"version": "1.0.3"
}