Skip to content

Instantly share code, notes, and snippets.

@Evgenus
Created July 3, 2014 20:02
Show Gist options
  • Save Evgenus/8741dea6cde9bd1d1288 to your computer and use it in GitHub Desktop.
Save Evgenus/8741dea6cde9bd1d1288 to your computer and use it in GitHub Desktop.
SJCL hash performance test
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://bitwiseshiftleft.github.io/sjcl/sjcl.js"></script>
<script type="text/javascript">
var c, i, q, sjcl, _i, _j;
c = "7";
for (i = _i = 1; _i <= 5; i = ++_i) {
c = "(" + c + " + " + c + ")";
}
q = c;
for (i = _j = 1; _j <= 12; i = ++_j) {
q = "(" + q + " + " + q + ")";
}
function hashfunc(data) {
return sjcl.codec.hex.fromBits(sjcl.hash.sha256.hash(data));
};
alert("data set = " + q.length)
</script>
</head>
<body>
<button onclick="alert(hashfunc(q))">Hit me!</button>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment