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 0.2.1 to 0.2.2

5

index.js

@@ -0,1 +1,2 @@

var Buffer = require('buffer').Buffer
var sha = require('./sha')

@@ -53,6 +54,6 @@ var rng = require('./rng')

try {
callback.call(this, undefined, rng(size));
callback.call(this, undefined, new Buffer(rng(size)));
} catch (err) { callback(err); }
} else {
return rng(size);
return new Buffer(rng(size));
}

@@ -59,0 +60,0 @@ }

23

package.json

@@ -5,3 +5,3 @@ {

"description": "partial implementation of crypto for the browser",
"version": "0.2.1",
"version": "0.2.2",
"homepage": "https://github.com/dominictarr/crypto-browserify",

@@ -22,3 +22,24 @@ "repository": {

},
"testling": {
"files": "test/*.js",
"browsers": {
"ie": [
8,
9
],
"firefox": [
13
],
"chrome": [
20
],
"safari": [
5.1
],
"opera": [
12
]
}
},
"optionalDependencies": {}
}

@@ -5,6 +5,6 @@ var test = require("tape")

var cryptoB = require('../')
var assert = require('assert')
function assertSame (fn) {
test(fn.name, function (t) {
t.plan(1)
fn(crypto, function (err, expected) {

@@ -27,11 +27,12 @@ fn(cryptoB, function (err, actual) {

assert.equal(cryptoB.randomBytes(10).length, 10)
test('randomBytes', function (t) {
t.plan(5)
t.equal(cryptoB.randomBytes(10).length, 10)
t.ok(cryptoB.randomBytes(10) instanceof Buffer)
cryptoB.randomBytes(10, function(ex, bytes) {
assert.ifError(ex)
bytes.forEach(function(bite) {
assert.equal(typeof bite, 'number')
})
t.error(ex)
t.equal(bytes.length, 10)
t.ok(bytes instanceof Buffer)
t.end()
})
})
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