Commit 825b7f5d6cf62e27901bb25d8aa1174175515a12
remove redundant example
Signed-off-by: wanderer <mjbecze@gmail.com>wanderer committed on 10/7/2017, 10:02:09 PM
Parent: 505e85ffe559bfa6be28987b425bb6e6880096dc
Files changed
examples/diffieHellman.js | changed |
examples/dh.js | deleted |
examples/diffieHellman.js | |||
---|---|---|---|
@@ -1,6 +1,7 @@ | |||
1 | 1 … | const bls = require('../') | |
2 | 2 … | ||
3 … | +// Diffie–Hellman key exchange | ||
3 | 4 … | bls.onModuleInit(() => { | |
4 | 5 … | bls.init() | |
5 | 6 … | ||
6 | 7 … | const sk1 = bls.secretKey() | |
@@ -11,13 +12,15 @@ | |||
11 | 12 … | ||
12 | 13 … | bls.getPublicKey(pk1, sk1) | |
13 | 14 … | bls.getPublicKey(pk2, sk2) | |
14 | 15 … | ||
15 | - const out1 = bls.publicKey() | ||
16 | - const out2 = bls.publicKey() | ||
16 … | + const sharedSec1 = bls.publicKey() | ||
17 … | + const sharedSec2 = bls.publicKey() | ||
17 | 18 … | ||
18 | - bls.dhKeyExchange(out1, sk1, pk2) | ||
19 | - bls.dhKeyExchange(out2, sk2, pk1) | ||
19 … | + bls.dhKeyExchange(sharedSec1, sk1, pk2) | ||
20 … | + bls.dhKeyExchange(sharedSec2, sk2, pk1) | ||
20 | 21 … | ||
21 | - const r = bls.publicKeyIsEqual(out1, out2) | ||
22 … | + const r = bls.publicKeyIsEqual(sharedSec1, sharedSec2) | ||
22 | 23 … | console.log(r) | |
24 … | + | ||
25 … | + bls.freeArray([sk1, sk2, pk1, pk2, sharedSec2, sharedSec1]) | ||
23 | 26 … | }) |
examples/dh.js | ||
---|---|---|
@@ -1,26 +1,0 @@ | ||
1 | -const bls = require('../') | |
2 | - | |
3 | -// Diffie–Hellman key exchange | |
4 | -bls.onModuleInit(() => { | |
5 | - bls.init() | |
6 | - | |
7 | - const sk1 = bls.secretKey() | |
8 | - const sk2 = bls.secretKey() | |
9 | - | |
10 | - const pk1 = bls.publicKey() | |
11 | - const pk2 = bls.publicKey() | |
12 | - | |
13 | - bls.getPublicKey(pk1, sk1) | |
14 | - bls.getPublicKey(pk2, sk2) | |
15 | - | |
16 | - const sharedSec1 = bls.publicKey() | |
17 | - const sharedSec2 = bls.publicKey() | |
18 | - | |
19 | - bls.dhKeyExchange(sharedSec1, sk1, pk2) | |
20 | - bls.dhKeyExchange(sharedSec2, sk2, pk1) | |
21 | - | |
22 | - const r = bls.publicKeyIsEqual(sharedSec1, sharedSec2) | |
23 | - console.log(r) | |
24 | - | |
25 | - bls.freeArray([sk1, sk2, pk1, pk2, sharedSec2, sharedSec1]) | |
26 | -}) |
Built with git-ssb-web