diff options
author | Determinant <[email protected]> | 2024-08-23 03:14:03 +0000 |
---|---|---|
committer | Determinant <[email protected]> | 2024-08-22 20:34:57 -0700 |
commit | 8d1c76ec7caf247d5675e14260d20fc508977ffb (patch) | |
tree | 8fa7c8ce3b7e3f4ece150a6da5922b5eb2dc7772 /frozen_deps/Cryptodome/Hash/TupleHash128.py | |
parent | 258780284151d49cba1d9c0d2ce33f9a19bb058b (diff) |
release v0.1.8
Diffstat (limited to 'frozen_deps/Cryptodome/Hash/TupleHash128.py')
-rw-r--r-- | frozen_deps/Cryptodome/Hash/TupleHash128.py | 18 |
1 files changed, 8 insertions, 10 deletions
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) |