From 8d1c76ec7caf247d5675e14260d20fc508977ffb Mon Sep 17 00:00:00 2001 From: Determinant Date: Fri, 23 Aug 2024 03:14:03 +0000 Subject: release v0.1.8 --- frozen_deps/Cryptodome/Hash/TupleHash128.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'frozen_deps/Cryptodome/Hash/TupleHash128.py') diff --git a/frozen_deps/Cryptodome/Hash/TupleHash128.py b/frozen_deps/Cryptodome/Hash/TupleHash128.py index 5c910e4..49aeccc 100644 --- a/frozen_deps/Cryptodome/Hash/TupleHash128.py +++ b/frozen_deps/Cryptodome/Hash/TupleHash128.py @@ -47,20 +47,21 @@ class TupleHash(object): self._cshake = cshake._new(b'', custom, b'TupleHash') self._digest = None - def update(self, data): - """Authenticate the next byte string in the tuple. + def update(self, *data): + """Authenticate the next tuple of byte strings. + TupleHash guarantees the logical separation between each byte string. Args: - data (bytes/bytearray/memoryview): The next byte string. + data (bytes/bytearray/memoryview): One or more items to hash. """ if self._digest is not None: raise TypeError("You cannot call 'update' after 'digest' or 'hexdigest'") - if not is_bytes(data): - raise TypeError("You can only call 'update' on bytes") - - self._cshake.update(_encode_str(tobytes(data))) + for item in data: + if not is_bytes(item): + raise TypeError("You can only call 'update' on bytes" ) + self._cshake.update(_encode_str(item)) return self @@ -132,7 +133,4 @@ def new(**kwargs): custom = kwargs.pop("custom", b'') - if kwargs: - raise TypeError("Unknown parameters: " + str(kwargs)) - return TupleHash(custom, cSHAKE128, digest_bytes) -- cgit v1.2.3-70-g09d2