-
Notifications
You must be signed in to change notification settings - Fork 289
/
Copy pathindex.php
72 lines (46 loc) · 1.45 KB
/
index.php
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
<?php
include( "settings.php" );
global $enableYubikey, $passwordHashingPepper;
?>
<script type="text/javascript" src="sha1.js"></script>
<script type="text/javascript">
function calcHMAC() {
try {
var hmacInput = document.getElementById("hmacInputText");
var pepperInput = document.getElementById("pepperInputText");
var hmacOutput = document.getElementById("hmacOutputText");
var shaObj = new jsSHA("SHA-1", "TEXT");
shaObj.setHMACKey( pepperInput.value, "TEXT" );
shaObj.update( hmacInput.value );
hmacOutput.value = shaObj.getHMAC("HEX");
} catch(e) {
hmacOutput.value = e.message
}
}
</script>
<body onload="calcHMAC()">
<FORM>
<INPUT TYPE="password" MAXLENGTH=20 SIZE=20 NAME="password" autofocus id="hmacInputText" onkeyup="calcHMAC()">
</FORM>
<FORM ACTION="server.php" METHOD="post">
<?php
if( $enableYubikey ) {
?>
<br>
Yubikey:<br>
<INPUT TYPE="password" MAXLENGTH=48 SIZE=48 NAME="yubikey">
<?php
}
?>
<INPUT TYPE="hidden" NAME="action" VALUE="show_data">
<INPUT TYPE="Submit" VALUE="login">
<br>
<br>
Server-provided Pepper:
<br>
<input type="text" size="75" name="pepper" readonly value="<?php echo $passwordHashingPepper;?>" id="pepperInputText">
<br>
hmac_sha1 of password with pepper as key:<br>
<input type="text" size="75" name="passwordHMAC" id="hmacOutputText">
</FORM>
</body>