crypto-browserify
Advanced tools
Comparing version 0.4.0 to 1.0.0
24
index.js
@@ -10,14 +10,14 @@ var Buffer = require('buffer').Buffer | ||
hex: sha.hex_sha1, | ||
binary: sha.b64_sha1, | ||
ascii: sha.str_sha1 | ||
base64: sha.b64_sha1, | ||
binary: sha.str_sha1 | ||
}, | ||
sha256: { | ||
hex: sha256.hex_sha256, | ||
binary: sha256.b64_sha256, | ||
ascii: sha256.str_sha256 | ||
base64: sha256.b64_sha256, | ||
binary: sha256.str_sha256 | ||
}, | ||
md5: { | ||
hex: md5.hex_md5, | ||
binary: md5.b64_md5, | ||
ascii: md5.any_md5 | ||
base64: md5.b64_md5, | ||
binary: md5.bin_md5 | ||
} | ||
@@ -29,14 +29,14 @@ } | ||
hex: sha.hex_hmac_sha1, | ||
binary: sha.b64_hmac_sha1, | ||
ascii: sha.str_hmac_sha1 | ||
base64: sha.b64_hmac_sha1, | ||
binary: sha.str_hmac_sha1 | ||
}, | ||
sha256: { | ||
hex: sha256.hex_hmac_sha256, | ||
binary: sha256.b64_hmac_sha256, | ||
ascii: sha256.str_hmac_sha256 | ||
base64: sha256.b64_hmac_sha256, | ||
binary: sha256.str_hmac_sha256 | ||
}, | ||
md5: { | ||
hex: md5.hex_hmac_md5, | ||
binary: md5.b64_hmac_md5, | ||
ascii: md5.any_hmac_md5 | ||
base64: md5.b64_hmac_md5, | ||
binary: md5.bin_hmac_md5 | ||
} | ||
@@ -43,0 +43,0 @@ } |
@@ -15,3 +15,3 @@ /* | ||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | ||
var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ | ||
@@ -24,2 +24,3 @@ /* | ||
function b64_md5(s) { return rstr2b64(rstr_md5(str2rstr_utf8(s))); } | ||
function bin_md5(s) { return rstr_md5(str2rstr_utf8(s)); } | ||
function any_md5(s, e) { return rstr2any(rstr_md5(str2rstr_utf8(s)), e); } | ||
@@ -30,2 +31,4 @@ function hex_hmac_md5(k, d) | ||
{ return rstr2b64(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d))); } | ||
function bin_hmac_md5(k, d) | ||
{ return rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)); } | ||
function any_hmac_md5(k, d, e) | ||
@@ -387,5 +390,7 @@ { return rstr2any(rstr_hmac_md5(str2rstr_utf8(k), str2rstr_utf8(d)), e); } | ||
exports.b64_md5 = b64_md5; | ||
exports.bin_md5 = bin_md5; | ||
exports.any_md5 = any_md5; | ||
exports.hex_hmac_md5 = hex_hmac_md5; | ||
exports.b64_hmac_md5 = b64_hmac_md5; | ||
exports.bin_hmac_md5 = bin_hmac_md5; | ||
exports.any_hmac_md5 = any_hmac_md5; |
@@ -5,3 +5,3 @@ { | ||
"description": "partial implementation of crypto for the browser", | ||
"version": "0.4.0", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/dominictarr/crypto-browserify", | ||
@@ -20,26 +20,17 @@ "repository": { | ||
"devDependencies": { | ||
"tape": "~0.1.5" | ||
"tape": "~1.0.4" | ||
}, | ||
"testling": { | ||
"files": "test/*.js", | ||
"browsers": { | ||
"ie": [ | ||
8, | ||
9 | ||
], | ||
"firefox": [ | ||
13 | ||
], | ||
"chrome": [ | ||
20 | ||
], | ||
"safari": [ | ||
5.1 | ||
], | ||
"opera": [ | ||
12 | ||
] | ||
} | ||
"browsers": [ | ||
"ie/8..latest", | ||
"chrome/20..latest", | ||
"firefox/10..latest", | ||
"safari/latest", | ||
"opera/11.0..latest", | ||
"iphone/6", | ||
"ipad/6" | ||
] | ||
}, | ||
"optionalDependencies": {} | ||
} |
@@ -21,5 +21,5 @@ /* | ||
*/ | ||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | ||
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ | ||
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
@@ -26,0 +26,0 @@ /* |
@@ -21,5 +21,5 @@ | ||
*/ | ||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */ | ||
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */ | ||
var b64pad = "="; /* base-64 pad character. "=" for strict RFC compliance */ | ||
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */ | ||
@@ -26,0 +26,0 @@ /* |
@@ -6,4 +6,4 @@ var test = require("tape") | ||
function assertSame (fn) { | ||
test(fn.name, function (t) { | ||
function assertSame(name, fn) { | ||
test(name, function (t) { | ||
t.plan(1) | ||
@@ -19,25 +19,19 @@ fn(crypto, function (err, expected) { | ||
assertSame(function sha1 (crypto, cb) { | ||
cb(null, crypto.createHash('sha1').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
var algorithms = ['sha1', 'sha256', 'md5']; | ||
var encodings = ['binary', 'hex', 'base64']; | ||
assertSame(function md5 (crypto, cb) { | ||
cb(null, crypto.createHash('md5').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assertSame(function sha256 (crypto, cb) { | ||
cb(null, crypto.createHash('sha256').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
algorithms.forEach(function (algorithm) { | ||
encodings.forEach(function (encoding) { | ||
assertSame(function sha1hmac (crypto, cb) { | ||
cb(null, crypto.createHmac('sha1', 'secret').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assertSame(algorithm + ' hash using ' + encoding, function (crypto, cb) { | ||
cb(null, crypto.createHash(algorithm).update('hello', 'utf-8').digest(encoding)); | ||
}) | ||
assertSame(function md5hmac (crypto, cb) { | ||
cb(null, crypto.createHmac('md5', 'secret').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
assertSame(algorithm + ' hmac using ' + encoding, function (crypto, cb) { | ||
cb(null, crypto.createHmac(algorithm, 'secret').update('hello', 'utf-8').digest(encoding)) | ||
}) | ||
assertSame(function sha256hmac (crypto, cb) { | ||
cb(null, crypto.createHmac('sha256', 'secret').update('hello', 'utf-8').digest('hex')) | ||
}) | ||
}); | ||
}); | ||
@@ -44,0 +38,0 @@ test('randomBytes', function (t) { |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
48934
13
0
1438