| 1 |
.. _shake128: |
| 2 |
|
| 3 |
SHAKE128 |
| 4 |
======== |
| 5 |
|
| 6 |
SHAKE128 is an *extendable-output function* (XOF) in the SHA-3 family, as specified in `FIPS 202`_. |
| 7 |
|
| 8 |
As a XOF, SHAKE128 is a generalization of a cryptographic hash function. |
| 9 |
Instead of creating a fixed-length digest (e.g. 32 bytes like SHA-2/256), |
| 10 |
it can produce outputs of any desired length. |
| 11 |
|
| 12 |
Output bits do **not** depend on the output length. |
| 13 |
|
| 14 |
The *128* in its name indicates its maximum security level (in bits), |
| 15 |
as described in Sections A.1 and A.2 of `FIPS 202`_. |
| 16 |
|
| 17 |
In the following example, the output is 26 bytes (208 bits) long:: |
| 18 |
|
| 19 |
>>> from Crypto.Hash import SHAKE128 |
| 20 |
>>> |
| 21 |
>>> shake = SHAKE128.new() |
| 22 |
>>> shake.update(b'Some data') |
| 23 |
>>> print(shake.read(26).hex()) |
| 24 |
|
| 25 |
.. _FIPS 202: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.202.pdf |
| 26 |
|
| 27 |
.. _SHA-2: http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf |
| 28 |
|
| 29 |
.. automodule:: Crypto.Hash.SHAKE128 |
| 30 |
:members: |