forked from pyca/ed25519
-
Notifications
You must be signed in to change notification settings - Fork 0
/
science.py
41 lines (32 loc) · 847 Bytes
/
science.py
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
import os
import timeit
import ed25519
seed = os.urandom(32)
data = b"The quick brown fox jumps over the lazy dog"
private_key = seed
public_key = ed25519.publickey(seed)
signature = ed25519.signature(data, private_key, public_key)
print('Time generate')
print(
timeit.timeit(
"ed25519.publickey(seed)",
setup="from __main__ import ed25519, seed",
number=10,
)
)
print('\nTime create signature')
print(
timeit.timeit(
"ed25519.signature(data, private_key, public_key)",
setup="from __main__ import ed25519, data, private_key, public_key",
number=10,
)
)
print('\nTime verify signature')
print(
timeit.timeit(
"ed25519.checkvalid(signature, data, public_key)",
setup="from __main__ import ed25519, signature, data, public_key",
number=10,
)
)