Socket
Socket
Sign inDemoInstall

crypto-browserify

Package Overview
Dependencies
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

crypto-browserify - npm Package Compare versions

Comparing version 1.0.6 to 1.0.7

test/vectors/byte-hashes.md5

5

package.json

@@ -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);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc