-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
77 lines (67 loc) · 2.55 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Password Check</title>
<script type="text/javascript" src="zxcvbn.js"></script>
<style>
.red {
color: red;
}
.green {
color: darkgreen;
}
</style>
</head>
<body>
<h2>Password Check</h2>
<label for="pwin">Password:</label>
<input type="password" id="pwin">
<p>The values is calculated by the zxcvbn lib on YOUR computer, no communication with external parties.<br>
<br>
Please follow the password rules:<br>
- at least 12 characters <br>
- small and big letters<br>
- numbers<br>
- special characters<br>
- better longer phrases than short and hard to remeber (see example) <br>
- Score >=3 <br>
=> Bad Password: ayd!3gg!<br>
=> Good Password: 41Pferde-sammeln-Kastanien (Random Passphrase -> easy to remember)
<br><br>
Score overview:<br>
0 # too guessable: risky password. (guesses < 10^3)<br>
1 # very guessable: protection from throttled online attacks. (guesses < 10^6)<br>
2 # somewhat guessable: protection from unthrottled online attacks. (guesses < 10^8)<br>
3 # safely unguessable: moderate protection from offline slow-hash scenario. (guesses < 10^10)<br>
4 # very unguessable: strong protection from offline slow-hash scenario. (guesses >= 10^10)
</p>
<hr>
<p id="entout"><strong>Please enter a password to determine its strength.</strong></p>
<hr>
<script>
document.addEventListener('DOMContentLoaded', () => {
document.querySelector('#pwin').addEventListener('keyup', (event) => {
let enteredPassword = event.target.value;
let x = zxcvbn(enteredPassword);
let good = false;
let regex = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])(?!.*\s).{12,}$/;
if (enteredPassword.match(regex) && x.score >= 3) {
good = true;
}
document.getElementById("entout").innerHTML = "<strong>Old entropy calc (sloppy)</strong>: " + Math
.log2(x.guesses) +
"<br><strong>Guesses</strong>: " + x.guesses + "<br><strong>Guesses(log10)</strong>: " + x
.guesses_log10 + "<br><strong>Score</strong>: " + x.score +
" of 4<br><strong>Feedback</strong>: " + x.feedback.warning +
"<br><br><hr>Is your password good? <b>" + (good ?
'<span class="green">Yes</span>' :
'<span class="red">No</span>') +
"</b>";
});
});
</script>
<p><a href="https://github.com/dropbox/zxcvbn">Lib Source</a>
<p>Made at Denic eG in Germany</p>
</body>
</html>