from functools import partial
from struct import pack
-from pygost.gost28147 import addmod
from pygost.gost28147 import block2ns
from pygost.gost28147 import encrypt
from pygost.gost28147 import ns2block
from pygost.utils import hexdec
from pygost.utils import hexenc
from pygost.utils import strxor
-from pygost.utils import xrange # pylint: disable=redefined-builtin
+from pygost.utils import xrange
DEFAULT_SBOX = "id-GostR3411-94-CryptoProParamSet"
for i in xrange(0, len(m), BLOCKSIZE):
part = m[i:i + BLOCKSIZE][::-1]
_len += len(part) * 8
- checksum = addmod(checksum, int(hexenc(part), 16), 2 ** 256)
+ checksum = (checksum + int(hexenc(part), 16)) % (2 ** 256)
if len(part) < BLOCKSIZE:
part = b"\x00" * (BLOCKSIZE - len(part)) + part
h = _step(h, part, self.sbox)