fix adler32 iterations

This commit is contained in:
Tomas Kopecek 2017-05-15 11:49:16 +02:00
parent 2a233d519f
commit 709cf93b75

View file

@ -467,14 +467,14 @@ class adler32_constructor(object):
#mimicing the hashlib constructors
def __init__(self, arg=''):
if six.PY3:
if six.PY3 and isinstance(arg, str):
arg = bytes(arg, 'utf-8')
self._value = adler32(arg) & 0xffffffff
#the bitwise and works around a bug in some versions of python
#see: https://bugs.python.org/issue1202
def update(self, arg):
if six.PY3:
if six.PY3 and isinstance(arg, str):
arg = bytes(arg, 'utf-8')
self._value = adler32(arg, self._value) & 0xffffffff