]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Cut the time to run the python ed25519 tests by a factor of ~6
authorNick Mathewson <nickm@torproject.org>
Sun, 31 Aug 2014 23:45:56 +0000 (19:45 -0400)
committerNick Mathewson <nickm@torproject.org>
Thu, 25 Sep 2014 19:08:32 +0000 (15:08 -0400)
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.

src/test/ed25519_exts_ref.py

index 199e1e1676c7ac60b50526b2d242e233deb2205f..0df5541d10c5feeb8d5d2369c96f4900e8f52e1a 100644 (file)
@@ -8,6 +8,7 @@
    Includes self-tester and test vector generator.
 """
 
+import slow_ed25519
 from slow_ed25519 import *
 
 import os
@@ -20,8 +21,7 @@ import binascii
 ell = l
 
 # This replaces expmod above and makes it go a lot faster.
-def expmod(b,e,m):
-    return pow(b,e,m)
+slow_ed25519.expmod = pow
 
 def curve25519ToEd25519(c, sign):
     u = decodeint(c)