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.0 to 0.1.1

238

example/bundle.js

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

var require = function (file, cwd) {
(function(){var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');

@@ -44,2 +44,3 @@ var mod = require.modules[resolved];

function loadAsFileSync (x) {
x = path.normalize(x);
if (require.modules[x]) {

@@ -57,3 +58,3 @@ return x;

x = x.replace(/\/+$/, '');
var pkgfile = x + '/package.json';
var pkgfile = path.normalize(x + '/package.json');
if (require.modules[pkgfile]) {

@@ -139,76 +140,44 @@ var pkg = require.modules[pkgfile]();

require.define = function (filename, fn) {
var dirname = require._core[filename]
? ''
: require.modules.path().dirname(filename)
;
(function () {
var process = {};
var require_ = function (file) {
return require(file, dirname)
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
};
require_.modules = require.modules;
require_.define = require.define;
var module_ = { exports : {} };
require.modules[filename] = function () {
require.modules[filename]._cached = module_.exports;
fn.call(
module_.exports,
require_,
module_,
module_.exports,
dirname,
filename
);
require.modules[filename]._cached = module_.exports;
return module_.exports;
};
};
if (typeof process === 'undefined') process = {};
if (!process.nextTick) process.nextTick = (function () {
var queue = [];
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canPost) {
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'browserify-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
}
return function (fn) {
if (canPost) {
queue.push(fn);
window.postMessage('browserify-tick', '*');
require.define = function (filename, fn) {
if (require.modules.__browserify_process) {
process = require.modules.__browserify_process();
}
else setTimeout(fn, 0);
var dirname = require._core[filename]
? ''
: require.modules.path().dirname(filename)
;
var require_ = function (file) {
return require(file, dirname)
};
require_.resolve = function (name) {
return require.resolve(name, dirname);
};
require_.modules = require.modules;
require_.define = require.define;
var module_ = { exports : {} };
require.modules[filename] = function () {
require.modules[filename]._cached = module_.exports;
fn.call(
module_.exports,
require_,
module_,
module_.exports,
dirname,
filename,
process
);
require.modules[filename]._cached = module_.exports;
return module_.exports;
};
};
})();
if (!process.title) process.title = 'browser';
if (!process.binding) process.binding = function (name) {
if (name === 'evals') return require('vm')
else throw new Error('No such module')
};
if (!process.cwd) process.cwd = function () { return '.' };
if (!process.env) process.env = {};
if (!process.argv) process.argv = [];
require.define("path", function (require, module, exports, __dirname, __filename) {
function filter (xs, fn) {
require.define("path",function(require,module,exports,__dirname,__filename,process){function filter (xs, fn) {
var res = [];

@@ -347,16 +316,61 @@ for (var i = 0; i < xs.length; i++) {

};
});
require.define("crypto", function (require, module, exports, __dirname, __filename) {
module.exports = require("crypto-browserify")
});
require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process){var process = module.exports = {};
require.define("/node_modules/crypto-browserify/package.json", function (require, module, exports, __dirname, __filename) {
module.exports = {}
process.nextTick = (function () {
var queue = [];
var canPost = typeof window !== 'undefined'
&& window.postMessage && window.addEventListener
;
if (canPost) {
window.addEventListener('message', function (ev) {
if (ev.source === window && ev.data === 'browserify-tick') {
ev.stopPropagation();
if (queue.length > 0) {
var fn = queue.shift();
fn();
}
}
}, true);
}
return function (fn) {
if (canPost) {
queue.push(fn);
window.postMessage('browserify-tick', '*');
}
else setTimeout(fn, 0);
};
})();
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.binding = function (name) {
if (name === 'evals') return (require)('vm')
else throw new Error('No such module. (Possibly not yet loaded)')
};
(function () {
var cwd = '/';
var path;
process.cwd = function () { return cwd };
process.chdir = function (dir) {
if (!path) path = require('path');
cwd = path.resolve(dir, cwd);
};
})();
});
require.define("/node_modules/crypto-browserify/index.js", function (require, module, exports, __dirname, __filename) {
var sha = require('./sha')
require.define("crypto",function(require,module,exports,__dirname,__filename,process){module.exports = require("crypto-browserify")});
require.define("/.nave/installed/0.6.18/lib/node_modules/browserify/node_modules/crypto-browserify/package.json",function(require,module,exports,__dirname,__filename,process){module.exports = {}});
require.define("/.nave/installed/0.6.18/lib/node_modules/browserify/node_modules/crypto-browserify/index.js",function(require,module,exports,__dirname,__filename,process){var sha = require('./sha')
var rng = require('./rng')
var algorithms = {

@@ -392,3 +406,3 @@ sha1: {

enc = enc || 'binary'
var fn
var fn
if(!(fn = _alg[enc]))

@@ -402,2 +416,13 @@ error('encoding:', enc , 'is not yet supported for algorithm', alg)

}
exports.randomBytes = function(size, callback) {
if (callback && callback.call) {
try {
callback.call(this, undefined, rng(size));
} catch (err) { callback(err); }
} else {
return rng(size);
}
}
// the least I can do is make error messages for the rest of the node.js/crypto api.

@@ -412,5 +437,4 @@ ;['createCredentials'

, 'createVerify'
, 'createDeffieHellman',
, 'pbkdf2',
, 'randomBytes' ].forEach(function (name) {
, 'createDeffieHellman'
, 'pbkdf2'].forEach(function (name) {
exports[name] = function () {

@@ -420,7 +444,5 @@ error('sorry,', name, 'is not implemented yet')

})
});
require.define("/node_modules/crypto-browserify/sha.js", function (require, module, exports, __dirname, __filename) {
/*
require.define("/.nave/installed/0.6.18/lib/node_modules/browserify/node_modules/crypto-browserify/sha.js",function(require,module,exports,__dirname,__filename,process){/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined

@@ -635,12 +657,48 @@ * in FIPS PUB 180-1

});
require.define("/test.js", function (require, module, exports, __dirname, __filename) {
var crypto = require('crypto')
require.define("/.nave/installed/0.6.18/lib/node_modules/browserify/node_modules/crypto-browserify/rng.js",function(require,module,exports,__dirname,__filename,process){// Original code adapted from Robert Kieffer.
// details at https://github.com/broofa/node-uuid
(function() {
var _global = this;
var mathRNG, whatwgRNG;
// NOTE: Math.random() does not guarantee "cryptographic quality"
mathRNG = function(size) {
var bytes = new Array(size);
var r;
for (var i = 0, r; i < size; i++) {
if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
bytes[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return bytes;
}
// currently only available in webkit-based browsers.
if (_global.crypto && crypto.getRandomValues) {
var _rnds = new Uint32Array(4);
whatwgRNG = function(size) {
var bytes = new Array(size);
crypto.getRandomValues(_rnds);
for (var c = 0 ; c < size; c++) {
bytes[c] = _rnds[c >> 2] >>> ((c & 0x03) * 8) & 0xff;
}
return bytes;
}
}
module.exports = whatwgRNG || mathRNG;
}())});
require.define("/d/crypto-browserify/example/test.js",function(require,module,exports,__dirname,__filename,process){var crypto = require('crypto')
var abc = crypto.createHash('sha1').update('abc').digest('hex')
console.log(abc)
//require('hello').inlineCall().call2()
});
require("/test.js");
require("/d/crypto-browserify/example/test.js");
})();

@@ -26,3 +26,3 @@ var sha = require('./sha')

var s = ''
_alg = algorithms[alg]
var _alg = algorithms[alg]
return {

@@ -29,0 +29,0 @@ update: function (data) {

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

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

@@ -8,0 +8,0 @@ "repository": {

@@ -25,2 +25,2 @@ var crypto = require('crypto')

});
})
})
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