crypto-browserify
Advanced tools
Comparing version 0.3.0 to 0.4.0
11
index.js
var Buffer = require('buffer').Buffer | ||
var sha = require('./sha') | ||
var sha256 = require('./sha256') | ||
var rng = require('./rng') | ||
@@ -12,2 +13,7 @@ var md5 = require('./md5') | ||
}, | ||
sha256: { | ||
hex: sha256.hex_sha256, | ||
binary: sha256.b64_sha256, | ||
ascii: sha256.str_sha256 | ||
}, | ||
md5: { | ||
@@ -26,2 +32,7 @@ hex: md5.hex_md5, | ||
}, | ||
sha256: { | ||
hex: sha256.hex_hmac_sha256, | ||
binary: sha256.b64_hmac_sha256, | ||
ascii: sha256.str_hmac_sha256 | ||
}, | ||
md5: { | ||
@@ -28,0 +39,0 @@ hex: md5.hex_hmac_md5, |
@@ -5,3 +5,3 @@ { | ||
"description": "partial implementation of crypto for the browser", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/dominictarr/crypto-browserify", | ||
@@ -8,0 +8,0 @@ "repository": { |
@@ -21,3 +21,2 @@ // Original code adapted from Robert Kieffer. | ||
// currently only available in webkit-based browsers. | ||
if (_global.crypto && crypto.getRandomValues) { | ||
@@ -38,2 +37,2 @@ var _rnds = new Uint32Array(4); | ||
}()) | ||
}()) |
@@ -26,2 +26,6 @@ var test = require("tape") | ||
assertSame(function sha256 (crypto, cb) { | ||
cb(null, crypto.createHash('sha256').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assertSame(function sha1hmac (crypto, cb) { | ||
@@ -35,2 +39,6 @@ cb(null, crypto.createHmac('sha1', 'secret').update('hello', 'utf-8').digest('hex')) | ||
assertSame(function sha256hmac (crypto, cb) { | ||
cb(null, crypto.createHmac('sha256', 'secret').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
test('randomBytes', function (t) { | ||
@@ -37,0 +45,0 @@ t.plan(5) |
48921
12
1439