tuple_hash.h File Reference

TupleHash hash function. More...

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

Go to the source code of this file.

Data Structures

struct  TupleHashContext
 TupleHash algorithm context. More...
 

Macros

#define TUPLE_HASH_CONTEXT_PRIVATE
 

Functions

error_t tupleHashCompute (uint_t strength, const DataFrag *dataFrags, uint_t dataNumFrags, const char_t *custom, size_t customLen, uint8_t *digest, size_t digestLen)
 Digest a message using TupleHash. More...
 
error_t tupleHashInit (TupleHashContext *context, uint_t strength, const char_t *custom, size_t customLen)
 Initialize TupleHash message digest context. More...
 
void tupleHashUpdate (TupleHashContext *context, const void *data, size_t length)
 Update the TupleHash context with a portion of the message being hashed. More...
 
void tupleHashFinal (TupleHashContext *context, uint8_t *digest, size_t length)
 Finish the TupleHash message digest. More...
 

Detailed Description

TupleHash hash function.

License

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

Copyright (C) 2010-2026 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.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.6.6

Definition in file tuple_hash.h.

Macro Definition Documentation

◆ TUPLE_HASH_CONTEXT_PRIVATE

#define TUPLE_HASH_CONTEXT_PRIVATE

Definition at line 40 of file tuple_hash.h.

Function Documentation

◆ tupleHashCompute()

error_t tupleHashCompute ( uint_t  strength,
const DataFrag *  dataFrags,
uint_t  dataNumFrags,
const char_t *  custom,
size_t  customLen,
uint8_t *  digest,
size_t  digestLen 
)

Digest a message using TupleHash.

Parameters
[in]strengthNumber of bits of security (128 for TupleHash128 and 256 for TupleHash256)
[in]dataFragsTuple of input strings (X)
[in]dataNumFragsNumber of input strings in the tuple (n)
[in]customCustomization string (S)
[in]customLenLength of the customization string
[out]digestCalculated digest
[in]digestLenExpected length of the digest (L)
Returns
Error code

Definition at line 60 of file tuple_hash.c.

◆ tupleHashFinal()

void tupleHashFinal ( TupleHashContext *  context,
uint8_t *  digest,
size_t  length 
)

Finish the TupleHash message digest.

Parameters
[in]contextPointer to the TupleHash context
[out]digestCalculated digest
[in]lengthExpected length of the digest (L)

Definition at line 162 of file tuple_hash.c.

◆ tupleHashInit()

error_t tupleHashInit ( TupleHashContext *  context,
uint_t  strength,
const char_t *  custom,
size_t  customLen 
)

Initialize TupleHash message digest context.

Parameters
[in]contextPointer to the TupleHash context to initialize
[in]strengthNumber of bits of security (128 for TupleHash128 and 256 for TupleHash256)
[in]customCustomization string (S)
[in]customLenLength of the customization string
Returns
Error code

Definition at line 123 of file tuple_hash.c.

◆ tupleHashUpdate()

void tupleHashUpdate ( TupleHashContext *  context,
const void *  data,
size_t  length 
)

Update the TupleHash context with a portion of the message being hashed.

Parameters
[in]contextPointer to the TupleHash context
[in]dataPointer to the input string
[in]lengthLength of the string

Definition at line 143 of file tuple_hash.c.