Better signing performance
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
dkimpy |
Fix Released
|
Medium
|
Stuart Gathman |
Bug Description
Attaching a patch that uses the Chinese remainder algorithm for computing RSA signatures. See http://
The crypto module had to be refactored a bit. The algorithm uses all private key components, so the full key is passed, not just the exponent and the modulus. There are now separate functions for signing (decrypting) and verifying (encrypting), instead of the single perform_rsa(), because verifying cannot be made faster this way.
The patch also updates tests. I removed the perform_rsa() test because I think it's obsolete now. The many signing and verifying test cases cover the low-level RSA functionality anyway.
I did a simple benchmark, where a message is signed 100 times:
Without the patch:
$ time python dkim_performance.py
real 0m3.815s
user 0m3.784s
sys 0m0.024s
With the patch applied:
$ time python dkim_performance.py
real 0m1.339s
user 0m1.308s
sys 0m0.028s
That is, on my machine it's now about 2.8x faster.
Changed in dkimpy: | |
assignee: | nobody → Stuart Gathman (stuart-gathman) |
milestone: | none → 0.5.1 |
importance: | Undecided → Medium |
Changed in dkimpy: | |
status: | New → Fix Committed |
Thanks. That looks reasonable to me on a brief read through. I agree
that the other tests should give some assurance that the results are
the same.