shake128.c File Reference

SHAKE128 extendable-output function (XOF) More...

#include "core/crypto.h"
#include "xof/shake128.h"

Go to the source code of this file.




error_t shake128Compute (const void *input, size_t inputLen, uint8_t *output, size_t outputLen)
 Digest a message using SHAKE128. More...
void shake128Init (Shake128Context *context)
 Initialize SHAKE128 context. More...
void shake128Absorb (Shake128Context *context, const void *input, size_t length)
 Absorb data. More...
void shake128Final (Shake128Context *context)
 Finish absorbing phase. More...
void shake128Squeeze (Shake128Context *context, uint8_t *output, size_t length)
 Extract data from the squeezing phase. More...


const uint8_t shake128Oid [9] = {0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0B}

Detailed Description

SHAKE128 extendable-output function (XOF)


SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2020 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneCRYPTO Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


SHAKE128 is a function on binary data in which the output can be extended to any desired length. SHAKE128 supports 128 bits of security strength. Refer to FIPS 202 for more details

Oryx Embedded SARL (

Definition in file shake128.c.

Macro Definition Documentation



Definition at line 38 of file shake128.c.

Function Documentation

◆ shake128Absorb()

void shake128Absorb ( Shake128Context context,
const void *  input,
size_t  length 

Absorb data.

[in]contextPointer to the SHAKE128 context
[in]inputPointer to the buffer being hashed
[in]lengthLength of the buffer

Definition at line 106 of file shake128.c.

◆ shake128Compute()

error_t shake128Compute ( const void *  input,
size_t  inputLen,
uint8_t *  output,
size_t  outputLen 

Digest a message using SHAKE128.

[in]inputPointer to the input data
[in]inputLenLength of the input data
[out]outputPointer to the output data
[in]outputLenExpected length of the output data
Error code

Definition at line 60 of file shake128.c.

◆ shake128Final()

void shake128Final ( Shake128Context context)

Finish absorbing phase.

[in]contextPointer to the SHAKE128 context

Definition at line 118 of file shake128.c.

◆ shake128Init()

void shake128Init ( Shake128Context context)

Initialize SHAKE128 context.

[in]contextPointer to the SHAKE128 context to initialize

Definition at line 92 of file shake128.c.

◆ shake128Squeeze()

void shake128Squeeze ( Shake128Context context,
uint8_t *  output,
size_t  length 

Extract data from the squeezing phase.

[in]contextPointer to the SHAKE128 context
[out]outputOutput string
[in]lengthDesired output length, in bytes

Definition at line 132 of file shake128.c.

Variable Documentation

◆ shake128Oid

const uint8_t shake128Oid[9] = {0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02, 0x0B}

Definition at line 48 of file shake128.c.