opnsense-ports/security/py-ed25519ll/files/patch-ed25519ll_djbec.py
Franco Fichtner 6163dc408b */*: sync with upstream
Taken from: HardenedBSD
2019-01-06 19:44:16 +01:00

15 lines
471 B
Python

--- ed25519ll/djbec.py.orig 2017-12-25 20:10:10 UTC
+++ ed25519ll/djbec.py
@@ -36,10 +36,8 @@ def H(m):
return hashlib.sha512(m).digest()
def expmod(b, e, m):
- if e == 0: return 1
- t = expmod(b, e // 2, m) ** 2 % m
- if e & 1: t = (t * b) % m
- return t
+ # the built-in pow is much faster
+ return pow(b,e,m)
# Can probably get some extra speedup here by replacing this with
# an extended-euclidean, but performance seems OK without that