From: Mark Wooding Date: Mon, 21 Oct 2019 19:06:31 +0000 (+0100) Subject: catacomb/__init__.py: Don't try to convert text strings to `ByteString'. X-Git-Url: https://git.distorted.org.uk/~mdw/catacomb-python/commitdiff_plain/3e611d8765877ea521d501f97184b7fc5edffd5c?hp=ab093124de0e9b0bb5d5797de7296161a2e62b40 catacomb/__init__.py: Don't try to convert text strings to `ByteString'. This won't work in Python 3, so get used to the idea. Fortunately, this only matters for the empty string, so use `ByteString.zero(0)' instead. --- diff --git a/catacomb/__init__.py b/catacomb/__init__.py index 22b1fdf..24f3a61 100644 --- a/catacomb/__init__.py +++ b/catacomb/__init__.py @@ -192,7 +192,7 @@ bytes = ByteString.fromhex ### Symmetric encryption. class _tmp: - def encrypt(me, n, m, tsz = None, h = ByteString('')): + def encrypt(me, n, m, tsz = None, h = ByteString.zero(0)): if tsz is None: tsz = me.__class__.tagsz.default e = me.enc(n, len(h), len(m), tsz) if not len(h): a = None @@ -200,7 +200,7 @@ class _tmp: c0 = e.encrypt(m) c1, t = e.done(aad = a) return c0 + c1, t - def decrypt(me, n, c, t, h = ByteString('')): + def decrypt(me, n, c, t, h = ByteString.zero(0)): d = me.dec(n, len(h), len(c), len(t)) if not len(h): a = None else: a = d.aad().hash(h)