-
Notifications
You must be signed in to change notification settings - Fork 8
/
curve25519.html
32 lines (32 loc) · 1.56 KB
/
curve25519.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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Generate a shared secret with Curve25519</title>
<script type="text/javascript" src="curve255.js"></script>
<script type="text/javascript">
// This version of the functions takes as arguments and returns keys in base32 encoding
function curve25519b32(a, b) {
if (b != null) {
b = c255lbase32decode(b);
};
return c255lbase32encode(curve25519(c255lbase32decode(a), b));
}
</script>
</head>
<body style="text-align:right;">
<h2>Generate a shared secret with Curve25519</h2>
Note: the keys accepted and printed in this form are base-32 encoded.
<br/>
<form>
My private key: <input style="text-align:right" type="password" name="privatekey" size=64 /><br />
<input type=button onClick="javascript:this.parentNode.mypublickey.value=curve25519b32(this.parentNode.privatekey.value)" value="Compute my public key" /><input style="text-align:right" type=text name="mypublickey" value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" size=64 /><br />
<br />
Public key: <input style="text-align:right" type="text" name="publickey" size=64 /><br />
<input type=button onClick="javascript:this.parentNode.sharedsecret.value=curve25519b32(this.parentNode.privatekey.value,this.parentNode.publickey.value)" value="Compute shared secret" /><input style="text-align:right" type=text name="sharedsecret" value="aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" size=64 />
</form>
<br/>
<a href="test/test.html">Verify current browser and library</a> -
<a href="https://github.com/rev22/curve255js">Source code on GitHub</a>
</body>
</html>