SHAKE256 is an extendable-output function (XOF) in the SHA-3 family, as specified in FIPS 202.

As a XOF, SHAKE256 is a generalization of a cryptographic hash function. Instead of creating a fixed-length digest (e.g. 32 bytes like SHA-2/256), it can produce outputs of any desired length.

Output bits do not depend on the output length.

The 256 in its name indicates its maximum security level (in bits), as described in Sections A.1 and A.2 of FIPS 202.

In the following example, the output is 26 bytes (208 bits) long:

>>> from Crypto.Hash import SHAKE256
>>> shake =
>>> shake.update(b'Some data')
>>> print(
class Crypto.Hash.SHAKE256.SHAKE256_XOF(data=None)

A SHAKE256 hash object. Do not instantiate directly. Use the new() function.

Variables:oid (string) – ASN.1 Object ID

Compute the next piece of XOF output.


You cannot use update() anymore after the first call to read().

Parameters:length (integer) – the amount of bytes this method must return
Returns:the next piece of XOF output (of the given length)
Return type:byte string

Continue hashing of a message by consuming the next chunk of data.

Parameters:data (byte string/byte array/memoryview) – The next chunk of the message being hashed.

Return a fresh instance of a SHAKE256 object.

Parameters:data (bytes/bytearray/memoryview) – The very first chunk of the message to hash. It is equivalent to an early call to update(). Optional.
Return:A SHAKE256_XOF object