X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=m_lib%2Fmd5wrapper.py;h=14013027f687356bf692cecee605bfdda9a0567d;hb=547baac5dc5c77a2f772a7b88101d434912fe1ce;hp=d428d55586841491926fdace564260768fdb86ef;hpb=31d88f65f0df3d05f8a7c65b743f301b6c6985c2;p=m_lib.git diff --git a/m_lib/md5wrapper.py b/m_lib/md5wrapper.py index d428d55..1401302 100755 --- a/m_lib/md5wrapper.py +++ b/m_lib/md5wrapper.py @@ -13,6 +13,8 @@ __all__ = ['md5wrapper'] class md5wrapper: def __init__(self, init=None): if init: + if not isinstance(init, bytes): + init = init.encode('ascii') self._md5 = md5(init) else: self._md5 = md5() @@ -25,6 +27,8 @@ class md5wrapper: def __repr__(self): str = self.digest() + if isinstance(str, bytes): + str = str.decode('latin1') return "%02x"*len(str) % tuple(map(ord, str)) # This nice was suggested by Guido