Electroneum
Macros | Typedefs | Functions | Variables
keccak.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "int-util.h"
#include "hash-ops.h"
#include "keccak.h"
Include dependency graph for keccak.c:

Macros

#define KECCAK_FINALIZED   0x80000000
 
#define KECCAK_BLOCKLEN   136
 
#define KECCAK_WORDS   17
 
#define KECCAK_DIGESTSIZE   32
 
#define IS_ALIGNED_64(p)   (0 == (7 & ((const char*)(p) - (const char*)0)))
 
#define KECCAK_PROCESS_BLOCK(st, block)
 

Typedefs

typedef uint64_t state_t[25]
 

Functions

static void local_abort (const char *msg)
 
void keccakf (uint64_t st[25], int rounds)
 
void keccak (const uint8_t *in, size_t inlen, uint8_t *md, int mdlen)
 
void keccak1600 (const uint8_t *in, size_t inlen, uint8_t *md)
 
void keccak_init (KECCAK_CTX *ctx)
 
void keccak_update (KECCAK_CTX *ctx, const uint8_t *in, size_t inlen)
 
void keccak_finish (KECCAK_CTX *ctx, uint8_t *md)
 

Variables

const uint64_t keccakf_rndc [24]
 
const int keccakf_rotc [24]
 
const int keccakf_piln [24]
 

Macro Definition Documentation

◆ IS_ALIGNED_64

#define IS_ALIGNED_64 (   p)    (0 == (7 & ((const char*)(p) - (const char*)0)))

◆ KECCAK_BLOCKLEN

#define KECCAK_BLOCKLEN   136

◆ KECCAK_DIGESTSIZE

#define KECCAK_DIGESTSIZE   32

◆ KECCAK_FINALIZED

#define KECCAK_FINALIZED   0x80000000

◆ KECCAK_PROCESS_BLOCK

#define KECCAK_PROCESS_BLOCK (   st,
  block 
)
Value:
{ \
for (int i_ = 0; i_ < KECCAK_WORDS; i_++){ \
((st))[i_] ^= swap64le(((block))[i_]); \
}; \
keccakf(st, KECCAK_ROUNDS); }
#define KECCAK_WORDS
Definition: keccak.c:147
#define KECCAK_ROUNDS
Definition: keccak.h:11

◆ KECCAK_WORDS

#define KECCAK_WORDS   17

Typedef Documentation

◆ state_t

typedef uint64_t state_t[25]

Function Documentation

◆ keccak()

void keccak ( const uint8_t *  in,
size_t  inlen,
uint8_t *  md,
int  mdlen 
)

◆ keccak1600()

void keccak1600 ( const uint8_t *  in,
size_t  inlen,
uint8_t *  md 
)

◆ keccak_finish()

void keccak_finish ( KECCAK_CTX ctx,
uint8_t *  md 
)

◆ keccak_init()

void keccak_init ( KECCAK_CTX ctx)

◆ keccak_update()

void keccak_update ( KECCAK_CTX ctx,
const uint8_t *  in,
size_t  inlen 
)

◆ keccakf()

void keccakf ( uint64_t  st[25],
int  rounds 
)

◆ local_abort()

static void local_abort ( const char *  msg)
static

Variable Documentation

◆ keccakf_piln

const int keccakf_piln[24]
Initial value:
=
{
10, 7, 11, 17, 18, 3, 5, 16, 8, 21, 24, 4,
15, 23, 19, 13, 12, 2, 20, 14, 22, 9, 6, 1
}

◆ keccakf_rndc

const uint64_t keccakf_rndc[24]
Initial value:
=
{
0x0000000000000001, 0x0000000000008082, 0x800000000000808a,
0x8000000080008000, 0x000000000000808b, 0x0000000080000001,
0x8000000080008081, 0x8000000000008009, 0x000000000000008a,
0x0000000000000088, 0x0000000080008009, 0x000000008000000a,
0x000000008000808b, 0x800000000000008b, 0x8000000000008089,
0x8000000000008003, 0x8000000000008002, 0x8000000000000080,
0x000000000000800a, 0x800000008000000a, 0x8000000080008081,
0x8000000000008080, 0x0000000080000001, 0x8000000080008008
}

◆ keccakf_rotc

const int keccakf_rotc[24]
Initial value:
=
{
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 2, 14,
27, 41, 56, 8, 25, 43, 62, 18, 39, 61, 20, 44
}