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

Go to the source code of this file.

Data Structures

struct  Keccak_HashInstance
 

Macros

#define Keccak_HashInitialize_SHAKE128(hashInstance)
 
#define Keccak_HashInitialize_SHAKE256(hashInstance)
 
#define Keccak_HashInitialize_SHA3_224(hashInstance)
 
#define Keccak_HashInitialize_SHA3_256(hashInstance)
 
#define Keccak_HashInitialize_SHA3_384(hashInstance)
 
#define Keccak_HashInitialize_SHA3_512(hashInstance)
 
#define Keccak_HashInstance_ImplType   32
 

Typedefs

typedef unsigned char BitSequence
 
typedef size_t DataLength
 

Enumerations

enum  HashReturn { SUCCESS = 0 , FAIL = 1 , BAD_HASHLEN = 2 }
 

Functions

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

Macro Definition Documentation

◆ Keccak_HashInitialize_SHA3_224

#define Keccak_HashInitialize_SHA3_224 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 1152, 448, 224, 0x06)
HashReturn Keccak_HashInitialize(Keccak_HashInstance *instance, unsigned int rate, unsigned int capacity, unsigned int hashbitlen, unsigned char delimitedSuffix)
Definition KeccakHash.c:21

Macro to initialize a SHA3-224 instance as specified in the FIPS 202 standard.

Definition at line 61 of file KeccakHash.h.

◆ Keccak_HashInitialize_SHA3_256

#define Keccak_HashInitialize_SHA3_256 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 1088, 512, 256, 0x06)

Macro to initialize a SHA3-256 instance as specified in the FIPS 202 standard.

Definition at line 65 of file KeccakHash.h.

◆ Keccak_HashInitialize_SHA3_384

#define Keccak_HashInitialize_SHA3_384 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 832, 768, 384, 0x06)

Macro to initialize a SHA3-384 instance as specified in the FIPS 202 standard.

Definition at line 69 of file KeccakHash.h.

◆ Keccak_HashInitialize_SHA3_512

#define Keccak_HashInitialize_SHA3_512 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 576, 1024, 512, 0x06)

Macro to initialize a SHA3-512 instance as specified in the FIPS 202 standard.

Definition at line 73 of file KeccakHash.h.

◆ Keccak_HashInitialize_SHAKE128

#define Keccak_HashInitialize_SHAKE128 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 1344, 256, 0, 0x1F)

Macro to initialize a SHAKE128 instance as specified in the FIPS 202 standard.

Definition at line 53 of file KeccakHash.h.

◆ Keccak_HashInitialize_SHAKE256

#define Keccak_HashInitialize_SHAKE256 ( hashInstance)
Value:
Keccak_HashInitialize(hashInstance, 1088, 512, 0, 0x1F)

Macro to initialize a SHAKE256 instance as specified in the FIPS 202 standard.

Definition at line 57 of file KeccakHash.h.

◆ Keccak_HashInstance_ImplType

#define Keccak_HashInstance_ImplType   32

Definition at line 111 of file KeccakHash.h.

Typedef Documentation

◆ BitSequence

typedef unsigned char BitSequence

Definition at line 24 of file KeccakHash.h.

◆ DataLength

typedef size_t DataLength

Definition at line 25 of file KeccakHash.h.

Enumeration Type Documentation

◆ HashReturn

enum HashReturn
Enumerator
SUCCESS 
FAIL 
BAD_HASHLEN 

Definition at line 26 of file KeccakHash.h.

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.