Commit 15570825 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 21220f75
...@@ -25,37 +25,11 @@ from __future__ import print_function ...@@ -25,37 +25,11 @@ from __future__ import print_function
import sys import sys
import hashlib import hashlib
import zlib import zlib
from zlib import crc32, adler32
from os.path import dirname from os.path import dirname
from zodbtools.util import Adler32Hasher, CRC32Hasher
from golang import testing from golang import testing
# adler32 in hashlib interface
class Adler32Hasher:
name = "adler32"
def __init__(self):
self.h = adler32('')
def update(self, data):
self.h = adler32(data, self.h)
def hexdigest(self):
return '%08x' % (self.h & 0xffffffff)
# crc32 in hashlib interface
class CRC32Hasher:
name = "crc32"
def __init__(self):
self.h = crc32('')
def update(self, data):
self.h = crc32(data, self.h)
def hexdigest(self):
return '%08x' % (self.h & 0xffffffff)
# fmtsize formats size in human readable form # fmtsize formats size in human readable form
_unitv = "BKMGT" # (2^10)^i represents by corresponding char suffix _unitv = "BKMGT" # (2^10)^i represents by corresponding char suffix
def fmtsize(size): def fmtsize(size):
......
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