Package Cryptodome :: Package Hash :: Module SHAKE128

Module SHAKE128

SHAKE128 extendable-output function (XOF).

SHAKE128 belongs to the SHA-3 family, as specified in FIPS 202.

As a XOF, SHAKE128 is a generalization of a cryptographic hash function. Instead of having a fixed-length output (e.g. 32 bytes like SHA-2/256), the output length for a XOF is unlimited.

The 128 in its name indicates its maximum security level (in bits), as described in Section A.2 of FIPS 202.

For instance:

>>> from Cryptodome.Hash import SHAKE128
>>> from binascii import hexlify
>>>
>>> shake = SHAKE128.new()
>>> shake.update(b'Some data')
>>> print hexlify(shake.read(26))
Classes
  SHAKE128_XOF
Class that implements a SHAKE128 XOF
Functions
 
new(data=None)
Return a fresh instance of a SHAKE128 object.
Variables
  __package__ = 'Cryptodome.Hash'
Function Details

new(data=None)

 
Return a fresh instance of a SHAKE128 object.
Parameters:
  • data (byte string) - The very first chunk of the message to hash. It is equivalent to an early call to update(). Optional.
Returns:
A SHAKE128_XOF object