[Pkg-privacy-commits] [obfsproxy] 201/353: Use 'powMod()' instead of the built-in 'pow()'.

Ximin Luo infinity0 at moszumanska.debian.org
Sat Aug 22 13:01:59 UTC 2015


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository obfsproxy.

commit 2f4560789ce7ed743b8bed32eb6e48dfe91a3dd1
Author: Philipp Winter <phw at torproject.org>
Date:   Sat Oct 26 19:13:22 2013 +0200

    Use 'powMod()' instead of the built-in 'pow()'.
    
    'powMod()' is faster than 'pow()' and will both make UniformDH computationally
    less expensive and create less of a timing signature.
---
 obfsproxy/transports/obfs3_dh.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/obfsproxy/transports/obfs3_dh.py b/obfsproxy/transports/obfs3_dh.py
index 117b66a..b35a334 100644
--- a/obfsproxy/transports/obfs3_dh.py
+++ b/obfsproxy/transports/obfs3_dh.py
@@ -1,6 +1,7 @@
 import binascii
 
 import obfsproxy.common.rand as rand
+import obfsproxy.common.modexp as modexp
 
 def int_to_bytes(lvalue, width):
     fmt = '%%.%dx' % (2*width)
@@ -51,7 +52,7 @@ class UniformDH:
         self.priv -= flip
 
         # Generate public key
-        self.pub = pow(self.g, self.priv, self.mod)
+        self.pub = modexp.powMod(self.g, self.priv, self.mod)
         if flip == 1:
             self.pub = self.mod - self.pub
         self.pub_str = int_to_bytes(self.pub, self.group_len)
@@ -71,6 +72,6 @@ class UniformDH:
         """
         their_pub = int(binascii.hexlify(their_pub_str), 16)
 
-        self.shared_secret = pow(their_pub, self.priv, self.mod)
+        self.shared_secret = modexp.powMod(their_pub, self.priv, self.mod)
         return int_to_bytes(self.shared_secret, self.group_len)
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/obfsproxy.git



More information about the Pkg-privacy-commits mailing list