evilaliv3/scrypt-async-js

View on GitHub
demo.html

Summary

Maintainability
Test Coverage
<!doctype html>
<html>
<body>
<script src="scrypt-async.js"></script>
<script>
function testMe() {
  var t1=(new Date()).getTime();
  //console.log('hashing...');
  var step = document.querySelector('#forstep').value;
  var logN = document.querySelector('#logn').value;
  var r = document.querySelector('#r').value;
  document.querySelector("#btn").disabled = true;
  document.querySelector("#btn").innerHTML = 'Wait...';
  scrypt([1,2,3], [4,5,6], logN, r, 32, step, function(res) {
    var t2 = ((new Date()).getTime()-t1);
    document.querySelector('#out').innerHTML = 'scrypt: <b>'+t2+' ms</b> ' + res;
    document.querySelector("#btn").disabled = false;
    document.querySelector("#btn").innerHTML = 'Calculate';
  }, "base64");
}
</script>
interruptStep: <input id="forstep" type="text" value="200"><br>
logN: <input id="logn" type="text" value="11"><br>
r: <input id="r" type="text" value="8"><br>
<noscript>Please enable JavaScript ;)</noscript>
<button id="btn" onclick="testMe()">Calculate</button>
<div id=out></div>