]> Cypherpunks.ru repositories - pygost.git/commitdiff
More addmod simplification
authorSergey Matveev <stargrave@stargrave.org>
Thu, 9 Jul 2020 07:50:02 +0000 (10:50 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Thu, 9 Jul 2020 07:50:02 +0000 (10:50 +0300)
pygost/gost28147.py

index 3d6705dbd1a2f542e2d2c07982ee1c2be0df38ab..b6f3cf49b6fa80a78918e7c411fab8b72f4effbd 100644 (file)
@@ -189,8 +189,7 @@ def ns2block(ns):
 def addmod(x, y, mod=2 ** 32):
     """ Modulo adding of two integers
     """
 def addmod(x, y, mod=2 ** 32):
     """ Modulo adding of two integers
     """
-    r = x + y
-    return r if r < mod else r % mod
+    return (x + y) % mod
 
 
 def _shift11(x):
 
 
 def _shift11(x):