crypto-browserify
Advanced tools
Comparing version 0.1.2 to 0.2.0
var sha = require('./sha') | ||
var rng = require('./rng') | ||
var md5 = require('./md5') | ||
@@ -9,2 +10,7 @@ var algorithms = { | ||
ascii: sha.str_sha1 | ||
}, | ||
md5: { | ||
hex: md5.hex_md5, | ||
binary: md5.b64_md5, | ||
ascii: md5.any_md5 | ||
} | ||
@@ -11,0 +17,0 @@ } |
@@ -5,7 +5,7 @@ { | ||
"description": "partial implementation of crypto for the browser", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/dominictarr/crypto-browserify", | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git://github.com/dominictarr/crypto-browserify.git" | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/dominictarr/crypto-browserify.git" | ||
}, | ||
@@ -19,4 +19,6 @@ "scripts": { | ||
"dependencies": {}, | ||
"devDependencies": {}, | ||
"devDependencies": { | ||
"tape": "~0.1.5" | ||
}, | ||
"optionalDependencies": {} | ||
} |
@@ -0,1 +1,3 @@ | ||
var test = require("tape") | ||
var crypto = require('crypto') | ||
@@ -5,7 +7,9 @@ var cryptoB = require('../') | ||
function assertSame (fn) { | ||
fn(crypto, function (err, expected) { | ||
fn(cryptoB, function (err, actual) { | ||
assert.equal(actual, expected) | ||
test(fn.name, function (t) { | ||
fn(crypto, function (err, expected) { | ||
fn(cryptoB, function (err, actual) { | ||
t.equal(actual, expected) | ||
t.end() | ||
}) | ||
}) | ||
@@ -15,13 +19,18 @@ }) | ||
assertSame(function (crypto, cb) { | ||
assertSame(function sha1 (crypto, cb) { | ||
cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assertSame(function md5(crypto, cb) { | ||
cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assert.equal(cryptoB.randomBytes(10).length, 10) | ||
cryptoB.randomBytes(10, function(ex, bytes) { | ||
assert.ifError(ex) | ||
bytes.forEach(function(bite) { | ||
assert.equal(typeof bite, 'number') | ||
}); | ||
}) | ||
test('randomBytes', function (t) { | ||
cryptoB.randomBytes(10, function(ex, bytes) { | ||
assert.ifError(ex) | ||
bytes.forEach(function(bite) { | ||
assert.equal(typeof bite, 'number') | ||
}) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
No License Found
License(Experimental) License information could not be found
Found 1 instance in 1 package
40431
10
1
1217
21
1