Beta 7 with some repo names changed.

This commit is contained in:
Luis Fernando Molina committed 2020-11-15 13:05:19 +01:00
1 parent 0f7b40cca7
commit 963c19493a
3408 files changed
+462217 -15516

No files matched your search

+62
View File
@@ -0,0 +1,62 @@
'use strict'
var inherits = require('inherits')
var Legacy = require('./legacy')
var Base = require('cipher-base')
var Buffer = require('safe-buffer').Buffer
var md5 = require('create-hash/md5')
var RIPEMD160 = require('ripemd160')
var sha = require('sha.js')
var ZEROS = Buffer.alloc(128)
function Hmac (alg, key) {
Base.call(this, 'digest')
if (typeof key === 'string') {
key = Buffer.from(key)
}
var blocksize = (alg === 'sha512' || alg === 'sha384') ? 128 : 64
this._alg = alg
this._key = key
if (key.length > blocksize) {
var hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
key = hash.update(key).digest()
} else if (key.length < blocksize) {
key = Buffer.concat([key, ZEROS], blocksize)
}
var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
var opad = this._opad = Buffer.allocUnsafe(blocksize)
for (var i = 0; i < blocksize; i++) {
ipad[i] = key[i] ^ 0x36
opad[i] = key[i] ^ 0x5C
}
this._hash = alg === 'rmd160' ? new RIPEMD160() : sha(alg)
this._hash.update(ipad)
}
inherits(Hmac, Base)
Hmac.prototype._update = function (data) {
this._hash.update(data)
}
Hmac.prototype._final = function () {
var h = this._hash.digest()
var hash = this._alg === 'rmd160' ? new RIPEMD160() : sha(this._alg)
return hash.update(this._opad).update(h).digest()
}
module.exports = function createHmac (alg, key) {
alg = alg.toLowerCase()
if (alg === 'rmd160' || alg === 'ripemd160') {
return new Hmac('rmd160', key)
}
if (alg === 'md5') {
return new Legacy(md5, key)
}
return new Hmac(alg, key)
}
+1
View File
@@ -0,0 +1 @@
module.exports = require('crypto').createHmac
+46
View File
@@ -0,0 +1,46 @@
'use strict'
var inherits = require('inherits')
var Buffer = require('safe-buffer').Buffer
var Base = require('cipher-base')
var ZEROS = Buffer.alloc(128)
var blocksize = 64
function Hmac (alg, key) {
Base.call(this, 'digest')
if (typeof key === 'string') {
key = Buffer.from(key)
}
this._alg = alg
this._key = key
if (key.length > blocksize) {
key = alg(key)
} else if (key.length < blocksize) {
key = Buffer.concat([key, ZEROS], blocksize)
}
var ipad = this._ipad = Buffer.allocUnsafe(blocksize)
var opad = this._opad = Buffer.allocUnsafe(blocksize)
for (var i = 0; i < blocksize; i++) {
ipad[i] = key[i] ^ 0x36
opad[i] = key[i] ^ 0x5C
}
this._hash = [ipad]
}
inherits(Hmac, Base)
Hmac.prototype._update = function (data) {
this._hash.push(data)
}
Hmac.prototype._final = function () {
var h = this._alg(Buffer.concat(this._hash))
return this._alg(Buffer.concat([this._opad, h]))
}
module.exports = Hmac
+73
View File
@@ -0,0 +1,73 @@
{
"_from": "create-hmac@^1.1.0",
"_id": "create-hmac@1.1.7",
"_inBundle": false,
"_integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==",
"_location": "/create-hmac",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "create-hmac@^1.1.0",
"name": "create-hmac",
"escapedName": "create-hmac",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/browserify-sign",
"/crypto-browserify",
"/ethereum-cryptography",
"/pbkdf2"
],
"_resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz",
"_shasum": "69170c78b3ab957147b2b8b04572e47ead2243ff",
"_spec": "create-hmac@^1.1.0",
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\crypto-browserify",
"author": "",
"browser": "./browser.js",
"bugs": {
"url": "https://github.com/crypto-browserify/createHmac/issues"
},
"bundleDependencies": false,
"dependencies": {
"cipher-base": "^1.0.3",
"create-hash": "^1.1.0",
"inherits": "^2.0.1",
"ripemd160": "^2.0.0",
"safe-buffer": "^5.0.1",
"sha.js": "^2.4.8"
},
"deprecated": false,
"description": "node style hmacs in the browser",
"devDependencies": {
"hash-test-vectors": "^1.3.2",
"standard": "^5.3.1",
"tap-spec": "^2.1.2",
"tape": "^3.0.3"
},
"files": [
"browser.js",
"index.js",
"legacy.js"
],
"homepage": "https://github.com/crypto-browserify/createHmac",
"keywords": [
"crypto",
"hmac"
],
"license": "MIT",
"main": "index.js",
"name": "create-hmac",
"repository": {
"type": "git",
"url": "git+https://github.com/crypto-browserify/createHmac.git"
},
"scripts": {
"standard": "standard",
"test": "npm run-script standard && npm run-script unit",
"unit": "node test.js | tspec"
},
"version": "1.1.7"
}