Skip to content

Commit

Permalink
better test cases + README tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Wheeler committed Apr 5, 2012
1 parent 899288a commit d1391a2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 103 deletions.
14 changes: 8 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ Installation
<script type="text/javascript" src="zxcvbn-async.js">
</script>

is the best way to add zxcvbn to your site. zxcvbn-async.js is a
tiny 350 bytes. On window.load, after your page loads and renders, it'll
fetch zxcvbn.js, which is more like 680k (300k gzipped), most of which
is a dictionary.
is the best way to add zxcvbn to your site. Host zxcvbn.js and
zxcvbn-async.js somewhere on your web server, and make the hardcoded
path inside zxcvbn-async.js point to zxcvbn.js. A relative path works
well.

(todo update size)
zxcvbn-async.js is a tiny 350 bytes. On window.load, after your page
loads and renders, it'll fetch zxcvbn.js, which is more like 700k (330k
gzipped), most of which is a series of dictionaries.

I haven't found 680k to be too large -- especially because a password
isn't the first thing a user typically enters on a registration form.
Expand All @@ -41,7 +43,7 @@ zxcvbn.js can also be included directly:
<script type="text/javascript" src="zxcvbn.js">
</script>

but this isn't recommended, as the 680k download will block your
But this isn't recommended, as the 680k download will block your
initial page load.

zxcvbn adds a single function to the global namespace:
Expand Down
71 changes: 5 additions & 66 deletions test/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
<script type="text/javascript" src="test.js">
</script>

<!--
<script type="text/javascript" src="http://dl.dropbox.com/u/209/zxcvbn-async.js">
<!-- best way to include zxcvbn: a small async loading script -->
<script type="text/javascript" src="zxcvbn-async.js">
</script>
-->

<!-- development setup below -->
<!--
<script type="text/javascript" src="../frequency_lists.js">
</script>
<script type="text/javascript" src="../adjacency_graphs.js">
Expand All @@ -24,71 +25,10 @@
</script>
<script type="text/javascript" src="../init.js">
</script>

-->
</head>
<body>
<style type="text/css">
/*
body {
font-family: monospace;
}
h1 {
font-weight: normal;
font-size: 120pt;
margin-bottom: 40px;
padding: 0;
}

h2 {
font-weight: normal;
font-size: 60pt;
}

h3 {
font-weight: normal;
font-size: 30pt;
}

#examples {
font-size: 40pt;
}

.match-sequence > table {
display: inline-block;
}

table#main {
width: 790;
border-collapse: collapse;
font-size: 16 px;
}
table#main > tr:nth-child(even) {
background-color: #ddd;
}
td, th {
padding: 20px 20px;
}

td:nth-child(1), th:nth-child(1) {
text-align: right;
}
.match-sequence td {
text-align: left;
}

#search-results td, #search-results th {
text-align: right;
}
.match:hover {
color: red;
}
#search-bar {
font-size: 50px;
padding: 25px;
width: 60%
}
*/


body {
font-family: monospace;
Expand Down Expand Up @@ -124,7 +64,6 @@ <h1>try zxcvbn</h1>
</div>

<div id="examples-container">
<h1 id="examples">examples</h1>
<div id="results">
</div>

Expand Down
41 changes: 10 additions & 31 deletions test/test.coffee
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@

test_passwords = '''
zxcvbn
THEFUTUREISNOW
backtothefuture
tr0ub4d0ur&3
correcthorsebatterystaple
coRrecth0rseba++ery9.23.2007staple$
tr0ub4d0ur&3
do you know
RAINBOWSHELL123698745
changeme83
sugarman4mayor
sugarman
temppass22
briansmith
briansmith4mayor
password1
viking
thx1138
ScoRpi0ns
rianhunter2000
ryanhunter2000
rianhunter2000
asdfghju7654rewq
AOEUIDHG&*()LS_
do you know
12345678
defghi6789
Expand All @@ -31,41 +30,21 @@ D0g..................
rosebud
Rosebud
rosebuD
RosebuD
ROSEBUD
rosebud99
Rosebud99
rosebuD99
RosebuD99
roSebud99
rosebuD
ros3bud99
r0s3bud99
r0$38ud99
R0$38uD99
R0$38UD99
r0$38UD99
r0$38Ud99
verlineVANDERMARK
eheuczkqyq
jrfkfrgexjlt
hztuyuyktcjhfoc
jhynqzmmzumhihwegxyy
DCcqyDaBdz
issswmuZkNGM
yUUjdWVoJBtErrM
rWibMFACxAUGZmxhVncy
>XE<68L3ju
WABu99[BK#6M
GaGxt<2qp4u3<dN
BgbH88Ba9ZyTofv)vs$w
Ba9ZyWABu99[BK#6MBgbH88Tofv)vs$w
'''

results_tmpl = '''
<h1 id="examples">examples</h1>
{{#results}}
<table class="result">
<tr>
Expand Down

0 comments on commit d1391a2

Please sign in to comment.