php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
KeccakSponge.h File Reference
#include <string.h>
#include "align.h"
#include "KeccakP-200-SnP.h"
#include "KeccakP-400-SnP.h"
#include "KeccakP-800-SnP.h"
#include "KeccakP-1600-SnP.h"

Go to the source code of this file.

Macros

#define KCP_DeclareSpongeStructure(prefix, size, alignment)
 
#define KCP_DeclareSpongeFunctions(prefix)
 

Functions

 KCP_DeclareSpongeStructure (KeccakWidth200, KeccakP200_stateSizeInBytes, KeccakP200_stateAlignment) KCP_DeclareSpongeFunctions(KeccakWidth200) KCP_DeclareSpongeStructure(KeccakWidth400
 
KeccakP400_stateAlignment KCP_DeclareSpongeFunctions (KeccakWidth400) KCP_DeclareSpongeStructure(KeccakWidth800
 
KeccakP400_stateAlignment KeccakP800_stateAlignment KCP_DeclareSpongeFunctions (KeccakWidth800) KCP_DeclareSpongeStructure(KeccakWidth1600
 
KeccakP400_stateAlignment KeccakP800_stateAlignment KeccakP1600_stateAlignment KCP_DeclareSpongeFunctions (KeccakWidth1600) KCP_DeclareSpongeStructure(KeccakWidth1600_12rounds
 

Variables

 KeccakP400_stateSizeInBytes
 
KeccakP400_stateAlignment KeccakP800_stateSizeInBytes
 
KeccakP400_stateAlignment KeccakP800_stateAlignment KeccakP1600_stateSizeInBytes
 

Macro Definition Documentation

◆ KCP_DeclareSpongeFunctions

#define KCP_DeclareSpongeFunctions ( prefix)
Value:
int prefix##_Sponge(unsigned int rate, unsigned int capacity, const unsigned char *input, size_t inputByteLen, unsigned char suffix, unsigned char *output, size_t outputByteLen); \
int prefix##_SpongeInitialize(prefix##_SpongeInstance *spongeInstance, unsigned int rate, unsigned int capacity); \
int prefix##_SpongeAbsorb(prefix##_SpongeInstance *spongeInstance, const unsigned char *data, size_t dataByteLen); \
int prefix##_SpongeAbsorbLastFewBits(prefix##_SpongeInstance *spongeInstance, unsigned char delimitedData); \
int prefix##_SpongeSqueeze(prefix##_SpongeInstance *spongeInstance, unsigned char *data, size_t dataByteLen);
#define prefix
zend_constant * data

Definition at line 141 of file KeccakSponge.h.

◆ KCP_DeclareSpongeStructure

#define KCP_DeclareSpongeStructure ( prefix,
size,
alignment )
Value:
ALIGN(alignment) typedef struct prefix##_SpongeInstanceStruct { \
unsigned char state[size]; \
unsigned int rate; \
unsigned int byteIOIndex; \
int squeezing; \
} prefix##_SpongeInstance;
new_type size
Definition ffi.c:4365
#define ALIGN(x)
Definition align.h:31

General information

The following type and functions are not actually implemented. Their documentation is generic, with the prefix Prefix replaced by

  • KeccakWidth200 for a sponge function based on Keccak-f[200]
  • KeccakWidth400 for a sponge function based on Keccak-f[400]
  • KeccakWidth800 for a sponge function based on Keccak-f[800]
  • KeccakWidth1600 for a sponge function based on Keccak-f[1600]

In all these functions, the rate and capacity must sum to the width of the chosen permutation. For instance, to use the sponge function Keccak[r=1344, c=256], one must use KeccakWidth1600_Sponge() or a combination of KeccakWidth1600_SpongeInitialize(), KeccakWidth1600_SpongeAbsorb(), KeccakWidth1600_SpongeAbsorbLastFewBits() and KeccakWidth1600_SpongeSqueeze().

The Prefix_SpongeInstance contains the sponge instance attributes for use with the Prefix_Sponge* functions. It gathers the state processed by the permutation as well as the rate, the position of input/output bytes in the state and the phase (absorbing or squeezing).

Definition at line 133 of file KeccakSponge.h.

Function Documentation

◆ KCP_DeclareSpongeFunctions() [1/3]

KeccakP400_stateAlignment KeccakP800_stateAlignment KeccakP1600_stateAlignment KCP_DeclareSpongeFunctions ( KeccakWidth1600 )

◆ KCP_DeclareSpongeFunctions() [2/3]

KeccakP400_stateAlignment KCP_DeclareSpongeFunctions ( KeccakWidth400 )

◆ KCP_DeclareSpongeFunctions() [3/3]

KeccakP400_stateAlignment KeccakP800_stateAlignment KCP_DeclareSpongeFunctions ( KeccakWidth800 )

◆ KCP_DeclareSpongeStructure()

KCP_DeclareSpongeStructure ( KeccakWidth200 ,
KeccakP200_stateSizeInBytes ,
KeccakP200_stateAlignment  )

Variable Documentation

◆ KeccakP1600_stateSizeInBytes

KeccakP400_stateAlignment KeccakP800_stateAlignment KeccakP1600_stateAlignment KeccakP1600_stateSizeInBytes

Definition at line 168 of file KeccakSponge.h.

◆ KeccakP400_stateSizeInBytes

KeccakP400_stateSizeInBytes

Definition at line 156 of file KeccakSponge.h.

◆ KeccakP800_stateSizeInBytes

KeccakP400_stateAlignment KeccakP800_stateSizeInBytes

Definition at line 162 of file KeccakSponge.h.