pass-gen
JavaScript performance comparison
Preparation code
<script>
Benchmark.prototype.setup = function() {
function passgen(len, alphabet) {
var result = '';
if (!alphabet) alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
var alphabetLength = alphabet.length;
if ((len === undefined) || isNaN(len)) len = 64;
for (var i = 0; i < len; i++) {
var rnd = Math.floor(Math.random() * alphabetLength);
result += alphabet[rnd];
}
return result;
}
function randomPass() {
var chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890'.split('');
var password = [];
var passwordLength = 16;
while (passwordLength--) { password.push( chars[ Math.round( Math.random() * chars.length ) ] ); }
return password.join('');
};
};
</script>
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
pass-gen |
|
pending… |
rotor |
|
pending… |
You can edit these tests or add even more tests to this page by appending /edit to the URL.
0 comments