From 55f0fc7026f9f95101f881768aece40d9c50773b Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 21 Oct 2019 20:06:31 +0100 Subject: [PATCH] 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. --- catacomb/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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) -- 2.11.0