Skip to content

Instantly share code, notes, and snippets.

@namelessjon
Created April 11, 2012 15:26
Show Gist options
  • Save namelessjon/2360033 to your computer and use it in GitHub Desktop.
Save namelessjon/2360033 to your computer and use it in GitHub Desktop.
hacky little js/html to figure out password entropy with zxcvbn and show password anatomy
<html>
<head>
<title>zxcvbn</title>
</head>
<body>
<h1>pass</h1>
<input />
<dl>
<dt>Entropy</dt>
<dd id='e'>0</dd>
<dt>Cracktime</dt>
<dd id='t'>instant</dd>
</dl>
<ul id='anatomy'>
</ul>
<script type="text/javascript" src="zxcvbn.js">
</script>
<script type="text/javascript" src="jquery-1.7.1.js">
</script>
<script type="text/javascript">
$(function () {
var $i = $('input'), $e = $('#e'), $t = $('#t'), $a = $('#anatomy');
$i.on('keyup', function (e) {
var res = zxcvbn($i.val());
$e.text(res.entropy);
$t.text(res.crack_time_display);
$a.hide().empty();
$.each(res.match_sequence, function () {
var li = $('<li />')
li.text('"' + this.token + '": ' + this.pattern + " / " + this.entropy);
$a.append(li);
});
$a.show();
});
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment