Package Cryptodome :: Package Hash :: Module SHAKE256

Module SHAKE256

SHAKE256 extendable-output function.

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

As a XOF, SHAKE256 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 256 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 SHAKE256
>>> from binascii import hexlify
>>>
>>> shake = SHAKE256.new()
>>> shake.update(b'Some data')
>>> print hexlify(shake.read(26))
Classes
  SHAKE256_XOF
Class that implements a SHAKE256 XOF
Functions
 
new(data=None)
Return a fresh instance of a SHAKE256 object.
Variables
  __package__ = 'Cryptodome.Hash'
Function Details

new(data=None)

 
Return a fresh instance of a SHAKE256 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 SHAKE256_XOF object