Commit 1418c86f authored by Kirill Smelkov's avatar Kirill Smelkov

utils: Initialize hashers with bytes

	self = <zodbtools.util.CRC32Hasher object at 0x7f887ae465f8>

	    def __init__(self):
	>       self._h = crc32('')
	E       TypeError: a bytes-like object is required, not 'str'

	util.py:208: TypeError

Based on patch by Jérome Perrin.
parent a7eee284
...@@ -188,7 +188,7 @@ class Adler32Hasher: ...@@ -188,7 +188,7 @@ class Adler32Hasher:
digest_size = 4 digest_size = 4
def __init__(self): def __init__(self):
self._h = adler32('') self._h = adler32(b'')
def update(self, data): def update(self, data):
self._h = adler32(data, self._h) self._h = adler32(data, self._h)
...@@ -205,7 +205,7 @@ class CRC32Hasher: ...@@ -205,7 +205,7 @@ class CRC32Hasher:
digest_size = 4 digest_size = 4
def __init__(self): def __init__(self):
self._h = crc32('') self._h = crc32(b'')
def update(self, data): def update(self, data):
self._h = crc32(data, self._h) self._h = crc32(data, self._h)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment