parallel_hash.c File Reference

ParallelHash hash function. More...

#include "core/crypto.h"
#include "hash/parallel_hash.h"

Go to the source code of this file.

Macros

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL
 

Functions

error_t parallelHashCompute (uint_t strength, size_t blockSize, const void *data, size_t dataLen, const char_t *custom, size_t customLen, uint8_t *digest, size_t digestLen)
 Digest a message using ParallelHash. More...
 
error_t parallelHashInit (ParallelHashContext *context, uint_t strength, size_t blockSize, const char_t *custom, size_t customLen)
 Initialize ParallelHash message digest context. More...
 
void parallelHashUpdate (ParallelHashContext *context, const void *data, size_t length)
 Update the ParallelHash context with a portion of the message being hashed. More...
 
void parallelHashFinal (ParallelHashContext *context, uint8_t *digest, size_t length)
 Finish the ParallelHash message digest. More...
 

Detailed Description

ParallelHash 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.

Description

The purpose of ParallelHash1 is to support the efficient hashing of very long strings, by taking advantage of the parallelism available in modern processors. ParallelHash supports the 128- and 256-bit security strengths

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

Definition in file parallel_hash.c.

Macro Definition Documentation

◆ TRACE_LEVEL

#define TRACE_LEVEL   CRYPTO_TRACE_LEVEL

Definition at line 38 of file parallel_hash.c.

Function Documentation

◆ parallelHashCompute()

error_t parallelHashCompute ( uint_t  strength,
size_t  blockSize,
const void *  data,
size_t  dataLen,
const char_t *  custom,
size_t  customLen,
uint8_t *  digest,
size_t  digestLen 
)

Digest a message using ParallelHash.

Parameters
[in]strengthNumber of bits of security (128 for ParallelHash128 and 256 for ParallelHash256)
[in]blockSizeBlock size in bytes for parallel hashing (B)
[in]dataPointer to the input string (X)
[in]dataLenLength of the input string
[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 62 of file parallel_hash.c.

◆ parallelHashFinal()

void parallelHashFinal ( ParallelHashContext *  context,
uint8_t *  digest,
size_t  length 
)

Finish the ParallelHash message digest.

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

Definition at line 225 of file parallel_hash.c.

◆ parallelHashInit()

error_t parallelHashInit ( ParallelHashContext *  context,
uint_t  strength,
size_t  blockSize,
const char_t *  custom,
size_t  customLen 
)

Initialize ParallelHash message digest context.

Parameters
[in]contextPointer to the ParallelHash context to initialize
[in]strengthNumber of bits of security (128 for ParallelHash128 and 256 for ParallelHash256)
[in]blockSizeBlock size in bytes for parallel hashing (B)
[in]customCustomization string (S)
[in]customLenLength of the customization string
Returns
Error code

Definition at line 121 of file parallel_hash.c.

◆ parallelHashUpdate()

void parallelHashUpdate ( ParallelHashContext *  context,
const void *  data,
size_t  length 
)

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

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

Definition at line 176 of file parallel_hash.c.