crypto-browserify
Advanced tools
Comparing version 1.0.6 to 1.0.7
@@ -5,3 +5,3 @@ { | ||
"description": "partial implementation of crypto for the browser", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"homepage": "https://github.com/dominictarr/crypto-browserify", | ||
@@ -34,4 +34,7 @@ "repository": { | ||
}, | ||
"browserify": { | ||
"transform": ["brfs"] | ||
}, | ||
"optionalDependencies": {}, | ||
"license": "MIT" | ||
} |
@@ -13,10 +13,2 @@ /* | ||
/* | ||
* Perform a simple self-test to see if the VM is working | ||
*/ | ||
function sha1_vm_test() | ||
{ | ||
return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d"; | ||
} | ||
/* | ||
* Calculate the SHA-1 of an array of big-endian words, and a bit length | ||
@@ -23,0 +15,0 @@ */ |
@@ -5,2 +5,3 @@ var test = require('tape'); | ||
var cryptoB = require('../'); | ||
var fs = require('fs'); | ||
@@ -47,3 +48,22 @@ function assertSame(name, fn) { | ||
function pad(n, w) { | ||
n = n + ''; return new Array(w - n.length + 1).join('0') + n; | ||
} | ||
var vectors = fs.readdirSync(__dirname + '/vectors').sort(). | ||
filter(function (t) { return t.match(/\.dat$/); }). | ||
map(function (t) { return fs.readFileSync(__dirname + '/vectors/' + t); }); | ||
['md5', 'sha1', 'sha256'].forEach(function (algorithm) { | ||
test(algorithm, function (t) { | ||
function hash(data) { return cryptoB.createHash(algorithm).update(data).digest('hex'); } | ||
var hashes = fs.readFileSync(__dirname + '/vectors/byte-hashes.' + algorithm).toString().split(/\r?\n/); | ||
t.plan(vectors.length); | ||
for (var i = 0; i < vectors.length; i++) { | ||
t.equal(hash(vectors[i]), hashes[i], 'byte' + pad(i, 4) + '.dat'); | ||
} | ||
}); | ||
}); | ||
test('randomBytes', function (t) { | ||
@@ -50,0 +70,0 @@ t.plan(5); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
371948
217
1178
9