Socket
Socket
Sign inDemoInstall

crypto-browserify

Package Overview
Dependencies
0
Maintainers
1
Versions
75
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.2.0

md5.js

6

index.js
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 @@ }

12

package.json

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

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc