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

+30
View File
@@ -0,0 +1,30 @@
'use strict'
var inherits = require('inherits')
var MD5 = require('md5.js')
var RIPEMD160 = require('ripemd160')
var sha = require('sha.js')
var Base = require('cipher-base')
function Hash (hash) {
Base.call(this, 'digest')
this._hash = hash
}
inherits(Hash, Base)
Hash.prototype._update = function (data) {
this._hash.update(data)
}
Hash.prototype._final = function () {
return this._hash.digest()
}
module.exports = function createHash (alg) {
alg = alg.toLowerCase()
if (alg === 'md5') return new MD5()
if (alg === 'rmd160' || alg === 'ripemd160') return new RIPEMD160()
return new Hash(sha(alg))
}
+1
View File
@@ -0,0 +1 @@
module.exports = require('crypto').createHash
+5
View File
@@ -0,0 +1,5 @@
var MD5 = require('md5.js')
module.exports = function (buffer) {
return new MD5().update(buffer).digest()
}
+72
View File
@@ -0,0 +1,72 @@
{
"_from": "create-hash@^1.1.0",
"_id": "create-hash@1.2.0",
"_inBundle": false,
"_integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==",
"_location": "/create-hash",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "create-hash@^1.1.0",
"name": "create-hash",
"escapedName": "create-hash",
"rawSpec": "^1.1.0",
"saveSpec": null,
"fetchSpec": "^1.1.0"
},
"_requiredBy": [
"/browserify-aes",
"/browserify-sign",
"/bs58check",
"/create-hmac",
"/crypto-browserify",
"/ethereum-cryptography",
"/ethereumjs-util",
"/pbkdf2",
"/public-encrypt"
],
"_resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz",
"_shasum": "889078af11a63756bcfb59bd221996be3a9ef196",
"_spec": "create-hash@^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/createHash/issues"
},
"bundleDependencies": false,
"dependencies": {
"cipher-base": "^1.0.1",
"inherits": "^2.0.1",
"md5.js": "^1.3.4",
"ripemd160": "^2.0.1",
"sha.js": "^2.4.0"
},
"deprecated": false,
"description": "create hashes for browserify",
"devDependencies": {
"hash-test-vectors": "^1.3.2",
"safe-buffer": "^5.0.1",
"standard": "^10.0.2",
"tap-spec": "^2.1.2",
"tape": "^4.6.3"
},
"homepage": "https://github.com/crypto-browserify/createHash",
"keywords": [
"crypto"
],
"license": "MIT",
"main": "index.js",
"name": "create-hash",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/crypto-browserify/createHash.git"
},
"scripts": {
"standard": "standard",
"test": "npm run-script standard && npm run-script unit",
"unit": "node test.js | tspec"
},
"version": "1.2.0"
}
+41
View File
@@ -0,0 +1,41 @@
var test = require('tape')
var Buffer = require('safe-buffer').Buffer
var algorithms = ['sha1', 'sha224', 'sha256', 'sha384', 'sha512', 'md5', 'rmd160', 'ripemd160']
var encodings = ['hex', 'base64'] // ignore binary
var vectors = require('hash-test-vectors')
vectors.forEach(function (vector) {
vector.ripemd160 = vector.rmd160
})
var createHash = require('./browser')
algorithms.forEach(function (algorithm) {
test('test ' + algorithm + ' against test vectors', function (t) {
vectors.forEach(function (obj, i) {
var input = Buffer.from(obj.input, 'base64')
var node = obj[algorithm]
var js = createHash(algorithm).update(input).digest('hex')
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
})
encodings.forEach(function (encoding) {
vectors.forEach(function (obj, i) {
var input = Buffer.from(obj.input, 'base64').toString(encoding)
var node = obj[algorithm]
var js = createHash(algorithm).update(input, encoding).digest('hex')
t.equal(js, node, algorithm + '(testVector[' + i + '], ' + encoding + ') == ' + node)
})
})
vectors.forEach(function (obj, i) {
var input = Buffer.from(obj.input, 'base64')
var node = obj[algorithm]
var hash = createHash(algorithm)
hash.end(input)
var js = hash.read().toString('hex')
t.equal(js, node, algorithm + '(testVector[' + i + ']) == ' + node)
})
t.end()
})
})