FFFF describe precompute option for keys · tlsfuzzer/python-ecdsa@21a17f6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 21a17f6

Browse files
committed
describe precompute option for keys
1 parent bdabc0f commit 21a17f6

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,25 @@ sk2 = make_key(b"2-"+seed) # different key
329329
assert sk1a.to_string() != sk2.to_string()
330330
```
331331

332+
In case the application will verify a lot of signatures made with a single
333+
key, it's possible to precompute some of the internal values to make
334+
signature verification significantly faster. The break-even point occurs at
335+
about 100 signatures verified.
336+
337+
To perform precomputation, you can call the `precompute()` method
338+
on `VerifyingKey` instance:
339+
```python
340+
from ecdsa import SigningKey, NIST384p
341+
sk = SigningKey.generate(curve=NIST384p)
342+
vk = sk.verifying_key
343+
vk.precompute()
344+
signature = sk.sign(b"message")
345+
assert vk.verify(signature, b"message")
346+
```
347+
348+
Once `precompute()` was called, all signature verifications with this key will
349+
be faster to execute.
350+
332351
## OpenSSL Compatibility
333352

334353
To produce signatures that can be verified by OpenSSL tools, or to verify

0 commit comments

Comments
 (0)
0