mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-24 14:51:11 +01:00
Cut the time to run the python ed25519 tests by a factor of ~6
I know it's pointless to optimize them, but I just can't let them spend all that time in expmod() when native python pow() does the same thing.
This commit is contained in:
parent
7ca470e13c
commit
6981341764
1 changed files with 2 additions and 2 deletions
|
@ -8,6 +8,7 @@
|
||||||
Includes self-tester and test vector generator.
|
Includes self-tester and test vector generator.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import slow_ed25519
|
||||||
from slow_ed25519 import *
|
from slow_ed25519 import *
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -20,8 +21,7 @@ import binascii
|
||||||
ell = l
|
ell = l
|
||||||
|
|
||||||
# This replaces expmod above and makes it go a lot faster.
|
# This replaces expmod above and makes it go a lot faster.
|
||||||
def expmod(b,e,m):
|
slow_ed25519.expmod = pow
|
||||||
return pow(b,e,m)
|
|
||||||
|
|
||||||
def curve25519ToEd25519(c, sign):
|
def curve25519ToEd25519(c, sign):
|
||||||
u = decodeint(c)
|
u = decodeint(c)
|
||||||
|
|
Loading…
Add table
Reference in a new issue