crypto-browserify
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -1,2 +0,2 @@ | ||
(function(){var require = function (file, cwd) { | ||
var require = function (file, cwd) { | ||
var resolved = require.resolve(file, cwd || '/'); | ||
@@ -44,3 +44,2 @@ var mod = require.modules[resolved]; | ||
function loadAsFileSync (x) { | ||
x = path.normalize(x); | ||
if (require.modules[x]) { | ||
@@ -58,3 +57,3 @@ return x; | ||
x = x.replace(/\/+$/, ''); | ||
var pkgfile = path.normalize(x + '/package.json'); | ||
var pkgfile = x + '/package.json'; | ||
if (require.modules[pkgfile]) { | ||
@@ -140,44 +139,76 @@ var pkg = require.modules[pkgfile](); | ||
(function () { | ||
var process = {}; | ||
require.define = function (filename, fn) { | ||
var dirname = require._core[filename] | ||
? '' | ||
: require.modules.path().dirname(filename) | ||
; | ||
require.define = function (filename, fn) { | ||
if (require.modules.__browserify_process) { | ||
process = require.modules.__browserify_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', '*'); | ||
} | ||
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; | ||
}; | ||
else setTimeout(fn, 0); | ||
}; | ||
})(); | ||
if (!process.title) process.title = 'browser'; | ||
require.define("path",function(require,module,exports,__dirname,__filename,process){function filter (xs, fn) { | ||
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) { | ||
var res = []; | ||
@@ -316,61 +347,16 @@ for (var i = 0; i < xs.length; i++) { | ||
}; | ||
}); | ||
require.define("__browserify_process",function(require,module,exports,__dirname,__filename,process){var process = module.exports = {}; | ||
require.define("crypto", function (require, module, exports, __dirname, __filename) { | ||
module.exports = require("crypto-browserify") | ||
}); | ||
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/package.json", function (require, module, exports, __dirname, __filename) { | ||
module.exports = {} | ||
}); | ||
require.define("crypto",function(require,module,exports,__dirname,__filename,process){module.exports = require("crypto-browserify")}); | ||
require.define("/node_modules/crypto-browserify/index.js", function (require, module, exports, __dirname, __filename) { | ||
var sha = require('./sha') | ||
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 = { | ||
@@ -406,3 +392,3 @@ sha1: { | ||
enc = enc || 'binary' | ||
var fn | ||
var fn | ||
if(!(fn = _alg[enc])) | ||
@@ -416,13 +402,2 @@ 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. | ||
@@ -437,4 +412,5 @@ ;['createCredentials' | ||
, 'createVerify' | ||
, 'createDeffieHellman' | ||
, 'pbkdf2'].forEach(function (name) { | ||
, 'createDeffieHellman', | ||
, 'pbkdf2', | ||
, 'randomBytes' ].forEach(function (name) { | ||
exports[name] = function () { | ||
@@ -444,5 +420,7 @@ error('sorry,', name, 'is not implemented yet') | ||
}) | ||
}); | ||
require.define("/.nave/installed/0.6.18/lib/node_modules/browserify/node_modules/crypto-browserify/sha.js",function(require,module,exports,__dirname,__filename,process){/* | ||
require.define("/node_modules/crypto-browserify/sha.js", function (require, module, exports, __dirname, __filename) { | ||
/* | ||
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined | ||
@@ -657,48 +635,12 @@ * in FIPS PUB 180-1 | ||
}); | ||
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') | ||
require.define("/test.js", function (require, module, exports, __dirname, __filename) { | ||
var crypto = require('crypto') | ||
var abc = crypto.createHash('sha1').update('abc').digest('hex') | ||
console.log(abc) | ||
//require('hello').inlineCall().call2() | ||
}); | ||
require("/d/crypto-browserify/example/test.js"); | ||
})(); | ||
require("/test.js"); |
@@ -5,6 +5,7 @@ { | ||
"description": "partial implementation of crypto for the browser", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"homepage": "https://github.com/dominictarr/crypto-browserify", | ||
"repository": { | ||
"url": "" | ||
"repository" : { | ||
"type" : "git", | ||
"url" : "git://github.com/dominictarr/crypto-browserify.git" | ||
}, | ||
@@ -11,0 +12,0 @@ "scripts": { |
@@ -25,2 +25,2 @@ var crypto = require('crypto') | ||
}); | ||
}) | ||
}) |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
0
27762
851