aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-02-04 02:45:49 +0100
committerMattias Andrée <maandree@operamail.com>2013-02-04 02:45:49 +0100
commitc7d0d7c3b6cf4825947e56dfd69531be4b7f28c3 (patch)
tree4f06807844ddca43582fb8abe3557566bc7e3c50
parentm (diff)
downloadsha3sum-c7d0d7c3b6cf4825947e56dfd69531be4b7f28c3.tar.gz
sha3sum-c7d0d7c3b6cf4825947e56dfd69531be4b7f28c3.tar.bz2
sha3sum-c7d0d7c3b6cf4825947e56dfd69531be4b7f28c3.tar.xz
small rotation optimisation
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rwxr-xr-xsha3sum.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/sha3sum.py b/sha3sum.py
index 35b71dd..b79c4d4 100755
--- a/sha3sum.py
+++ b/sha3sum.py
@@ -85,7 +85,8 @@ class SHA3:
@param n:int Rotation steps
@return :int The value rotated
'''
- return ((x >> (SHA3.w - (n % SHA3.w))) + (x << (n % SHA3.w))) & SHA3.wmod
+ m = n % SHA3.w
+ return ((x >> (SHA3.w - m)) + (x << m)) & SHA3.wmod
@staticmethod