php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
KeccakHash.c File Reference
#include <string.h>
#include "KeccakHash.h"

Go to the source code of this file.

Functions

HashReturn Keccak_HashInitialize (Keccak_HashInstance *instance, unsigned int rate, unsigned int capacity, unsigned int hashbitlen, unsigned char delimitedSuffix)
 
HashReturn Keccak_HashUpdate (Keccak_HashInstance *instance, const BitSequence *data, DataLength databitlen)
 
HashReturn Keccak_HashFinal (Keccak_HashInstance *instance, BitSequence *hashval)
 
HashReturn Keccak_HashSqueeze (Keccak_HashInstance *instance, BitSequence *data, DataLength databitlen)
 

Function Documentation

◆ Keccak_HashFinal()

HashReturn Keccak_HashFinal ( Keccak_HashInstance * hashInstance,
BitSequence * hashval )

Function to call after all input blocks have been input and to get output bits if the length was specified when calling Keccak_HashInitialize().

Parameters
hashInstancePointer to the hash instance initialized by Keccak_HashInitialize(). If hashbitlen was not 0 in the call to Keccak_HashInitialize(), the number of output bits is equal to hashbitlen. If hashbitlen was 0 in the call to Keccak_HashInitialize(), the output bits must be extracted using the Keccak_HashSqueeze() function.
hashvalPointer to the buffer where to store the output data.
Returns
SUCCESS if successful, FAIL otherwise.

Definition at line 64 of file KeccakHash.c.

◆ Keccak_HashInitialize()

HashReturn Keccak_HashInitialize ( Keccak_HashInstance * hashInstance,
unsigned int rate,
unsigned int capacity,
unsigned int hashbitlen,
unsigned char delimitedSuffix )

Function to initialize the Keccak[r, c] sponge function instance used in sequential hashing mode.

Parameters
hashInstancePointer to the hash instance to be initialized.
rateThe value of the rate r.
capacityThe value of the capacity c.
hashbitlenThe desired number of output bits, or 0 for an arbitrarily-long output.
delimitedSuffixBits that will be automatically appended to the end of the input message, as in domain separation. This is a byte containing from 0 to 7 bits formatted like the delimitedData parameter of the Keccak_SpongeAbsorbLastFewBits() function.
Precondition
One must have r+c=1600 and the rate a multiple of 8 bits in this implementation.
Returns
SUCCESS if successful, FAIL otherwise.

Definition at line 21 of file KeccakHash.c.

◆ Keccak_HashSqueeze()

HashReturn Keccak_HashSqueeze ( Keccak_HashInstance * hashInstance,
BitSequence * data,
DataLength databitlen )

Function to squeeze output data.

Parameters
hashInstancePointer to the hash instance initialized by Keccak_HashInitialize().
dataPointer to the buffer where to store the output data.
databitlenThe number of output bits desired (must be a multiple of 8).
Precondition
Keccak_HashFinal() must have been already called.
databitlen is a multiple of 8.
Returns
SUCCESS if successful, FAIL otherwise.

Definition at line 75 of file KeccakHash.c.

◆ Keccak_HashUpdate()

HashReturn Keccak_HashUpdate ( Keccak_HashInstance * hashInstance,
const BitSequence * data,
DataLength databitlen )

Function to give input data to be absorbed.

Parameters
hashInstancePointer to the hash instance initialized by Keccak_HashInitialize().
dataPointer to the input data. When databitLen is not a multiple of 8, the last bits of data must be in the least significant bits of the last byte (little-endian convention).
databitLenThe number of input bits provided in the input data.
Precondition
In the previous call to Keccak_HashUpdate(), databitlen was a multiple of 8.
Returns
SUCCESS if successful, FAIL otherwise.

Definition at line 37 of file KeccakHash.c.