Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

keccak.c File Reference
#include <stddef.h>
#include <string.h>
#include "sph_keccak.h"
+ Include dependency graph for keccak.c:

Go to the source code of this file.

Macros

#define SPH_KECCAK_INTERLEAVE   1
 
#define SPH_KECCAK_UNROLL   8
 
#define SPH_KECCAK_NOCOPY   0
 
#define INTERLEAVE(xl, xh)
 
#define UNINTERLEAVE(xl, xh)
 
#define DECL_STATE
 
#define READ_STATE(state)
 
#define WRITE_STATE(state)
 
#define READ64(d, off)
 
#define INPUT_BUF144
 
#define INPUT_BUF136
 
#define INPUT_BUF104
 
#define INPUT_BUF72
 
#define INPUT_BUF(lim)
 
#define DECL64(x)   sph_u64 x ## l, x ## h
 
#define MOV64(d, s)   (d ## l = s ## l, d ## h = s ## h)
 
#define XOR64(d, a, b)   (d ## l = a ## l ^ b ## l, d ## h = a ## h ^ b ## h)
 
#define AND64(d, a, b)   (d ## l = a ## l & b ## l, d ## h = a ## h & b ## h)
 
#define OR64(d, a, b)   (d ## l = a ## l | b ## l, d ## h = a ## h | b ## h)
 
#define NOT64(d, s)   (d ## l = SPH_T32(~s ## l), d ## h = SPH_T32(~s ## h))
 
#define ROL64(d, v, n)   ROL64_ ## n(d, v)
 
#define ROL64_odd1(d, v)
 
#define ROL64_odd63(d, v)
 
#define ROL64_odd(d, v, n)
 
#define ROL64_even(d, v, n)
 
#define ROL64_0(d, v)
 
#define ROL64_1(d, v)   ROL64_odd1(d, v)
 
#define ROL64_2(d, v)   ROL64_even(d, v, 1)
 
#define ROL64_3(d, v)   ROL64_odd( d, v, 2)
 
#define ROL64_4(d, v)   ROL64_even(d, v, 2)
 
#define ROL64_5(d, v)   ROL64_odd( d, v, 3)
 
#define ROL64_6(d, v)   ROL64_even(d, v, 3)
 
#define ROL64_7(d, v)   ROL64_odd( d, v, 4)
 
#define ROL64_8(d, v)   ROL64_even(d, v, 4)
 
#define ROL64_9(d, v)   ROL64_odd( d, v, 5)
 
#define ROL64_10(d, v)   ROL64_even(d, v, 5)
 
#define ROL64_11(d, v)   ROL64_odd( d, v, 6)
 
#define ROL64_12(d, v)   ROL64_even(d, v, 6)
 
#define ROL64_13(d, v)   ROL64_odd( d, v, 7)
 
#define ROL64_14(d, v)   ROL64_even(d, v, 7)
 
#define ROL64_15(d, v)   ROL64_odd( d, v, 8)
 
#define ROL64_16(d, v)   ROL64_even(d, v, 8)
 
#define ROL64_17(d, v)   ROL64_odd( d, v, 9)
 
#define ROL64_18(d, v)   ROL64_even(d, v, 9)
 
#define ROL64_19(d, v)   ROL64_odd( d, v, 10)
 
#define ROL64_20(d, v)   ROL64_even(d, v, 10)
 
#define ROL64_21(d, v)   ROL64_odd( d, v, 11)
 
#define ROL64_22(d, v)   ROL64_even(d, v, 11)
 
#define ROL64_23(d, v)   ROL64_odd( d, v, 12)
 
#define ROL64_24(d, v)   ROL64_even(d, v, 12)
 
#define ROL64_25(d, v)   ROL64_odd( d, v, 13)
 
#define ROL64_26(d, v)   ROL64_even(d, v, 13)
 
#define ROL64_27(d, v)   ROL64_odd( d, v, 14)
 
#define ROL64_28(d, v)   ROL64_even(d, v, 14)
 
#define ROL64_29(d, v)   ROL64_odd( d, v, 15)
 
#define ROL64_30(d, v)   ROL64_even(d, v, 15)
 
#define ROL64_31(d, v)   ROL64_odd( d, v, 16)
 
#define ROL64_32(d, v)   ROL64_even(d, v, 16)
 
#define ROL64_33(d, v)   ROL64_odd( d, v, 17)
 
#define ROL64_34(d, v)   ROL64_even(d, v, 17)
 
#define ROL64_35(d, v)   ROL64_odd( d, v, 18)
 
#define ROL64_36(d, v)   ROL64_even(d, v, 18)
 
#define ROL64_37(d, v)   ROL64_odd( d, v, 19)
 
#define ROL64_38(d, v)   ROL64_even(d, v, 19)
 
#define ROL64_39(d, v)   ROL64_odd( d, v, 20)
 
#define ROL64_40(d, v)   ROL64_even(d, v, 20)
 
#define ROL64_41(d, v)   ROL64_odd( d, v, 21)
 
#define ROL64_42(d, v)   ROL64_even(d, v, 21)
 
#define ROL64_43(d, v)   ROL64_odd( d, v, 22)
 
#define ROL64_44(d, v)   ROL64_even(d, v, 22)
 
#define ROL64_45(d, v)   ROL64_odd( d, v, 23)
 
#define ROL64_46(d, v)   ROL64_even(d, v, 23)
 
#define ROL64_47(d, v)   ROL64_odd( d, v, 24)
 
#define ROL64_48(d, v)   ROL64_even(d, v, 24)
 
#define ROL64_49(d, v)   ROL64_odd( d, v, 25)
 
#define ROL64_50(d, v)   ROL64_even(d, v, 25)
 
#define ROL64_51(d, v)   ROL64_odd( d, v, 26)
 
#define ROL64_52(d, v)   ROL64_even(d, v, 26)
 
#define ROL64_53(d, v)   ROL64_odd( d, v, 27)
 
#define ROL64_54(d, v)   ROL64_even(d, v, 27)
 
#define ROL64_55(d, v)   ROL64_odd( d, v, 28)
 
#define ROL64_56(d, v)   ROL64_even(d, v, 28)
 
#define ROL64_57(d, v)   ROL64_odd( d, v, 29)
 
#define ROL64_58(d, v)   ROL64_even(d, v, 29)
 
#define ROL64_59(d, v)   ROL64_odd( d, v, 30)
 
#define ROL64_60(d, v)   ROL64_even(d, v, 30)
 
#define ROL64_61(d, v)   ROL64_odd( d, v, 31)
 
#define ROL64_62(d, v)   ROL64_even(d, v, 31)
 
#define ROL64_63(d, v)   ROL64_odd63(d, v)
 
#define XOR64_IOTA(d, s, k)   (d ## l = s ## l ^ k.low, d ## h = s ## h ^ k.high)
 
#define TH_ELT(t, c0, c1, c2, c3, c4, d0, d1, d2, d3, d4)
 
#define THETA(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, b40, b41, b42, b43, b44)
 
#define RHO(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, b40, b41, b42, b43, b44)
 
#define KHI_XO(d, a, b, c)
 
#define KHI_XA(d, a, b, c)
 
#define KHI(b00, b01, b02, b03, b04, b10, b11, b12, b13, b14, b20, b21, b22, b23, b24, b30, b31, b32, b33, b34, b40, b41, b42, b43, b44)
 
#define IOTA(r)   XOR64_IOTA(a00, a00, r)
 
#define P0
 
#define P1
 
#define P2
 
#define P3
 
#define P4
 
#define P5
 
#define P6
 
#define P7
 
#define P8
 
#define P9
 
#define P10
 
#define P11
 
#define P12
 
#define P13
 
#define P14
 
#define P15
 
#define P16
 
#define P17
 
#define P18
 
#define P19
 
#define P20
 
#define P21
 
#define P22
 
#define P23
 
#define P1_TO_P0
 
#define P2_TO_P0
 
#define P4_TO_P0
 
#define P6_TO_P0
 
#define P8_TO_P0
 
#define P12_TO_P0
 
#define LPAR   (
 
#define RPAR   )
 
#define KF_ELT(r, s, k)
 
#define DO(x)   x
 
#define KECCAK_F_1600   DO(KECCAK_F_1600_)
 
#define KECCAK_F_1600_
 
#define DEFCLOSE(d, lim)
 

Functions

static void keccak_init (sph_keccak_context *kc, unsigned out_size)
 
static void keccak_core (sph_keccak_context *kc, const void *data, size_t len, size_t lim)
 
void sph_keccak224_init (void *cc)
 Initialize a Keccak-224 context. More...
 
void sph_keccak224 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_keccak224_close (void *cc, void *dst)
 Terminate the current Keccak-224 computation and output the result into the provided buffer. More...
 
void sph_keccak224_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (28 bytes). More...
 
void sph_keccak256_init (void *cc)
 Initialize a Keccak-256 context. More...
 
void sph_keccak256 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_keccak256_close (void *cc, void *dst)
 Terminate the current Keccak-256 computation and output the result into the provided buffer. More...
 
void sph_keccak256_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (32 bytes). More...
 
void sph_keccak384_init (void *cc)
 Initialize a Keccak-384 context. More...
 
void sph_keccak384 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_keccak384_close (void *cc, void *dst)
 Terminate the current Keccak-384 computation and output the result into the provided buffer. More...
 
void sph_keccak384_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (48 bytes). More...
 
void sph_keccak512_init (void *cc)
 Initialize a Keccak-512 context. More...
 
void sph_keccak512 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_keccak512_close (void *cc, void *dst)
 Terminate the current Keccak-512 computation and output the result into the provided buffer. More...
 
void sph_keccak512_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (64 bytes). More...
 

Variables

static const struct { ... }  RC []
 

Macro Definition Documentation

◆ AND64

#define AND64 (   d,
  a,
 
)    (d ## l = a ## l & b ## l, d ## h = a ## h & b ## h)

Definition at line 765 of file keccak.c.

◆ DECL64

#define DECL64 (   x)    sph_u64 x ## l, x ## h

Definition at line 762 of file keccak.c.

◆ DECL_STATE

#define DECL_STATE
Value:
sph_u32 a00l, a00h, a01l, a01h, a02l, a02h, a03l, a03h, a04l, a04h; \
sph_u32 a10l, a10h, a11l, a11h, a12l, a12h, a13l, a13h, a14l, a14h; \
sph_u32 a20l, a20h, a21l, a21h, a22l, a22h, a23l, a23h, a24l, a24h; \
sph_u32 a30l, a30h, a31l, a31h, a32l, a32h, a33l, a33h, a34l, a34h; \
sph_u32 a40l, a40h, a41l, a41h, a42l, a42h, a43l, a43h, a44l, a44h;
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 542 of file keccak.c.

Referenced by keccak_core().

◆ DEFCLOSE

#define DEFCLOSE (   d,
  lim 
)

Definition at line 1651 of file keccak.c.

◆ DO

#define DO (   x)    x

Definition at line 1399 of file keccak.c.

◆ INPUT_BUF

#define INPUT_BUF (   lim)
Value:
do { \
READ64(a00, 0); \
READ64(a10, 8); \
READ64(a20, 16); \
READ64(a30, 24); \
READ64(a40, 32); \
READ64(a01, 40); \
READ64(a11, 48); \
READ64(a21, 56); \
READ64(a31, 64); \
if ((lim) == 72) \
break; \
READ64(a41, 72); \
READ64(a02, 80); \
READ64(a12, 88); \
READ64(a22, 96); \
if ((lim) == 104) \
break; \
READ64(a32, 104); \
READ64(a42, 112); \
READ64(a03, 120); \
READ64(a13, 128); \
if ((lim) == 136) \
break; \
READ64(a23, 136); \
} while (0)

Definition at line 733 of file keccak.c.

Referenced by keccak_core().

◆ INPUT_BUF104

#define INPUT_BUF104
Value:
do { \
READ64(a00, 0); \
READ64(a10, 8); \
READ64(a20, 16); \
READ64(a30, 24); \
READ64(a40, 32); \
READ64(a01, 40); \
READ64(a11, 48); \
READ64(a21, 56); \
READ64(a31, 64); \
READ64(a41, 72); \
READ64(a02, 80); \
READ64(a12, 88); \
READ64(a22, 96); \
} while (0)

Definition at line 705 of file keccak.c.

◆ INPUT_BUF136

#define INPUT_BUF136
Value:
do { \
READ64(a00, 0); \
READ64(a10, 8); \
READ64(a20, 16); \
READ64(a30, 24); \
READ64(a40, 32); \
READ64(a01, 40); \
READ64(a11, 48); \
READ64(a21, 56); \
READ64(a31, 64); \
READ64(a41, 72); \
READ64(a02, 80); \
READ64(a12, 88); \
READ64(a22, 96); \
READ64(a32, 104); \
READ64(a42, 112); \
READ64(a03, 120); \
READ64(a13, 128); \
} while (0)

Definition at line 685 of file keccak.c.

◆ INPUT_BUF144

#define INPUT_BUF144
Value:
do { \
READ64(a00, 0); \
READ64(a10, 8); \
READ64(a20, 16); \
READ64(a30, 24); \
READ64(a40, 32); \
READ64(a01, 40); \
READ64(a11, 48); \
READ64(a21, 56); \
READ64(a31, 64); \
READ64(a41, 72); \
READ64(a02, 80); \
READ64(a12, 88); \
READ64(a22, 96); \
READ64(a32, 104); \
READ64(a42, 112); \
READ64(a03, 120); \
READ64(a13, 128); \
READ64(a23, 136); \
} while (0)

Definition at line 664 of file keccak.c.

◆ INPUT_BUF72

#define INPUT_BUF72
Value:
do { \
READ64(a00, 0); \
READ64(a10, 8); \
READ64(a20, 16); \
READ64(a30, 24); \
READ64(a40, 32); \
READ64(a01, 40); \
READ64(a11, 48); \
READ64(a21, 56); \
READ64(a31, 64); \
} while (0)

Definition at line 721 of file keccak.c.

◆ INTERLEAVE

#define INTERLEAVE (   xl,
  xh 
)
Value:
do { \
sph_u32 l, h, t; \
l = (xl); h = (xh); \
t = (l ^ (l >> 1)) & SPH_C32(0x22222222); l ^= t ^ (t << 1); \
t = (h ^ (h >> 1)) & SPH_C32(0x22222222); h ^= t ^ (t << 1); \
t = (l ^ (l >> 2)) & SPH_C32(0x0C0C0C0C); l ^= t ^ (t << 2); \
t = (h ^ (h >> 2)) & SPH_C32(0x0C0C0C0C); h ^= t ^ (t << 2); \
t = (l ^ (l >> 4)) & SPH_C32(0x00F000F0); l ^= t ^ (t << 4); \
t = (h ^ (h >> 4)) & SPH_C32(0x00F000F0); h ^= t ^ (t << 4); \
t = (l ^ (l >> 8)) & SPH_C32(0x0000FF00); l ^= t ^ (t << 8); \
t = (h ^ (h >> 8)) & SPH_C32(0x0000FF00); h ^= t ^ (t << 8); \
t = (l ^ SPH_T32(h << 16)) & SPH_C32(0xFFFF0000); \
l ^= t; h ^= t >> 16; \
(xl) = l; (xh) = h; \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932
#define SPH_C32(x)
Definition: sph_types.h:873

Definition at line 427 of file keccak.c.

◆ IOTA

#define IOTA (   r)    XOR64_IOTA(a00, a00, r)

Definition at line 1137 of file keccak.c.

◆ KECCAK_F_1600

#define KECCAK_F_1600   DO(KECCAK_F_1600_)

Definition at line 1401 of file keccak.c.

Referenced by keccak_core().

◆ KECCAK_F_1600_

#define KECCAK_F_1600_
Value:
do { \
int j; \
for (j = 0; j < 24; j += 8) { \
KF_ELT( 0, 1, RC[j + 0]); \
KF_ELT( 1, 2, RC[j + 1]); \
KF_ELT( 2, 3, RC[j + 2]); \
KF_ELT( 3, 4, RC[j + 3]); \
KF_ELT( 4, 5, RC[j + 4]); \
KF_ELT( 5, 6, RC[j + 5]); \
KF_ELT( 6, 7, RC[j + 6]); \
KF_ELT( 7, 8, RC[j + 7]); \
P8_TO_P0; \
} \
} while (0)
static const struct @0 RC[]

Definition at line 1454 of file keccak.c.

◆ KF_ELT

#define KF_ELT (   r,
  s,
 
)
Value:
do { \
THETA LPAR P ## r RPAR; \
RHO LPAR P ## r RPAR; \
KHI LPAR P ## s RPAR; \
IOTA(k); \
} while (0)
#define RPAR
Definition: keccak.c:1390
#define LPAR
Definition: keccak.c:1389

Definition at line 1392 of file keccak.c.

◆ KHI

#define KHI (   b00,
  b01,
  b02,
  b03,
  b04,
  b10,
  b11,
  b12,
  b13,
  b14,
  b20,
  b21,
  b22,
  b23,
  b24,
  b30,
  b31,
  b32,
  b33,
  b34,
  b40,
  b41,
  b42,
  b43,
  b44 
)

Definition at line 1070 of file keccak.c.

◆ KHI_XA

#define KHI_XA (   d,
  a,
  b,
 
)
Value:
do { \
DECL64(kt); \
AND64(kt, b, c); \
XOR64(d, a, kt); \
} while (0)

Definition at line 1064 of file keccak.c.

◆ KHI_XO

#define KHI_XO (   d,
  a,
  b,
 
)
Value:
do { \
DECL64(kt); \
OR64(kt, b, c); \
XOR64(d, a, kt); \
} while (0)

Definition at line 1058 of file keccak.c.

◆ LPAR

#define LPAR   (

Definition at line 1389 of file keccak.c.

◆ MOV64

#define MOV64 (   d,
 
)    (d ## l = s ## l, d ## h = s ## h)

Definition at line 763 of file keccak.c.

◆ NOT64

#define NOT64 (   d,
 
)    (d ## l = SPH_T32(~s ## l), d ## h = SPH_T32(~s ## h))

Definition at line 767 of file keccak.c.

◆ OR64

#define OR64 (   d,
  a,
 
)    (d ## l = a ## l | b ## l, d ## h = a ## h | b ## h)

Definition at line 766 of file keccak.c.

◆ P0

#define P0
Value:
a00, a01, a02, a03, a04, a10, a11, a12, a13, a14, a20, a21, \
a22, a23, a24, a30, a31, a32, a33, a34, a40, a41, a42, a43, a44

Definition at line 1139 of file keccak.c.

Referenced by SubBytes().

◆ P1

#define P1
Value:
a00, a30, a10, a40, a20, a11, a41, a21, a01, a31, a22, a02, \
a32, a12, a42, a33, a13, a43, a23, a03, a44, a24, a04, a34, a14

Definition at line 1141 of file keccak.c.

Referenced by SubBytes().

◆ P10

#define P10
Value:
a00, a24, a43, a12, a31, a34, a03, a22, a41, a10, a13, a32, \
a01, a20, a44, a42, a11, a30, a04, a23, a21, a40, a14, a33, a02

Definition at line 1159 of file keccak.c.

Referenced by SubBytes().

◆ P11

#define P11
Value:
a00, a42, a34, a21, a13, a03, a40, a32, a24, a11, a01, a43, \
a30, a22, a14, a04, a41, a33, a20, a12, a02, a44, a31, a23, a10

Definition at line 1161 of file keccak.c.

Referenced by SubBytes().

◆ P12

#define P12
Value:
a00, a04, a03, a02, a01, a40, a44, a43, a42, a41, a30, a34, \
a33, a32, a31, a20, a24, a23, a22, a21, a10, a14, a13, a12, a11

Definition at line 1163 of file keccak.c.

Referenced by SubBytes().

◆ P12_TO_P0

#define P12_TO_P0

Definition at line 1349 of file keccak.c.

◆ P13

#define P13
Value:
a00, a20, a40, a10, a30, a44, a14, a34, a04, a24, a33, a03, \
a23, a43, a13, a22, a42, a12, a32, a02, a11, a31, a01, a21, a41

Definition at line 1165 of file keccak.c.

Referenced by SubBytes().

◆ P14

#define P14
Value:
a00, a22, a44, a11, a33, a14, a31, a03, a20, a42, a23, a40, \
a12, a34, a01, a32, a04, a21, a43, a10, a41, a13, a30, a02, a24

Definition at line 1167 of file keccak.c.

Referenced by SubBytes().

◆ P15

#define P15
Value:
a00, a32, a14, a41, a23, a31, a13, a40, a22, a04, a12, a44, \
a21, a03, a30, a43, a20, a02, a34, a11, a24, a01, a33, a10, a42

Definition at line 1169 of file keccak.c.

Referenced by SubBytes().

◆ P16

#define P16
Value:
a00, a43, a31, a24, a12, a13, a01, a44, a32, a20, a21, a14, \
a02, a40, a33, a34, a22, a10, a03, a41, a42, a30, a23, a11, a04

Definition at line 1171 of file keccak.c.

Referenced by SubBytes().

◆ P17

#define P17
Value:
a00, a34, a13, a42, a21, a01, a30, a14, a43, a22, a02, a31, \
a10, a44, a23, a03, a32, a11, a40, a24, a04, a33, a12, a41, a20

Definition at line 1173 of file keccak.c.

Referenced by SubBytes().

◆ P18

#define P18
Value:
a00, a03, a01, a04, a02, a30, a33, a31, a34, a32, a10, a13, \
a11, a14, a12, a40, a43, a41, a44, a42, a20, a23, a21, a24, a22

Definition at line 1175 of file keccak.c.

Referenced by SubBytes().

◆ P19

#define P19
Value:
a00, a40, a30, a20, a10, a33, a23, a13, a03, a43, a11, a01, \
a41, a31, a21, a44, a34, a24, a14, a04, a22, a12, a02, a42, a32

Definition at line 1177 of file keccak.c.

Referenced by SubBytes().

◆ P1_TO_P0

#define P1_TO_P0
Value:
do { \
DECL64(t); \
MOV64(t, a01); \
MOV64(a01, a30); \
MOV64(a30, a33); \
MOV64(a33, a23); \
MOV64(a23, a12); \
MOV64(a12, a21); \
MOV64(a21, a02); \
MOV64(a02, a10); \
MOV64(a10, a11); \
MOV64(a11, a41); \
MOV64(a41, a24); \
MOV64(a24, a42); \
MOV64(a42, a04); \
MOV64(a04, a20); \
MOV64(a20, a22); \
MOV64(a22, a32); \
MOV64(a32, a43); \
MOV64(a43, a34); \
MOV64(a34, a03); \
MOV64(a03, a40); \
MOV64(a40, a44); \
MOV64(a44, a14); \
MOV64(a14, a31); \
MOV64(a31, a13); \
MOV64(a13, t); \
} while (0)

Definition at line 1188 of file keccak.c.

◆ P2

#define P2
Value:
a00, a33, a11, a44, a22, a41, a24, a02, a30, a13, a32, a10, \
a43, a21, a04, a23, a01, a34, a12, a40, a14, a42, a20, a03, a31

Definition at line 1143 of file keccak.c.

Referenced by SubBytes().

◆ P20

#define P20
Value:
a00, a44, a33, a22, a11, a23, a12, a01, a40, a34, a41, a30, \
a24, a13, a02, a14, a03, a42, a31, a20, a32, a21, a10, a04, a43

Definition at line 1179 of file keccak.c.

Referenced by SubBytes().

◆ P21

#define P21
Value:
a00, a14, a23, a32, a41, a12, a21, a30, a44, a03, a24, a33, \
a42, a01, a10, a31, a40, a04, a13, a22, a43, a02, a11, a20, a34

Definition at line 1181 of file keccak.c.

◆ P22

#define P22
Value:
a00, a31, a12, a43, a24, a21, a02, a33, a14, a40, a42, a23, \
a04, a30, a11, a13, a44, a20, a01, a32, a34, a10, a41, a22, a03

Definition at line 1183 of file keccak.c.

Referenced by SubBytes().

◆ P23

#define P23
Value:
a00, a13, a21, a34, a42, a02, a10, a23, a31, a44, a04, a12, \
a20, a33, a41, a01, a14, a22, a30, a43, a03, a11, a24, a32, a40

Definition at line 1185 of file keccak.c.

Referenced by SubBytes().

◆ P2_TO_P0

#define P2_TO_P0
Value:
do { \
DECL64(t); \
MOV64(t, a01); \
MOV64(a01, a33); \
MOV64(a33, a12); \
MOV64(a12, a02); \
MOV64(a02, a11); \
MOV64(a11, a24); \
MOV64(a24, a04); \
MOV64(a04, a22); \
MOV64(a22, a43); \
MOV64(a43, a03); \
MOV64(a03, a44); \
MOV64(a44, a31); \
MOV64(a31, t); \
MOV64(t, a10); \
MOV64(a10, a41); \
MOV64(a41, a42); \
MOV64(a42, a20); \
MOV64(a20, a32); \
MOV64(a32, a34); \
MOV64(a34, a40); \
MOV64(a40, a14); \
MOV64(a14, a13); \
MOV64(a13, a30); \
MOV64(a30, a23); \
MOV64(a23, a21); \
MOV64(a21, t); \
} while (0)

Definition at line 1217 of file keccak.c.

◆ P3

#define P3
Value:
a00, a23, a41, a14, a32, a24, a42, a10, a33, a01, a43, a11, \
a34, a02, a20, a12, a30, a03, a21, a44, a31, a04, a22, a40, a13

Definition at line 1145 of file keccak.c.

Referenced by SubBytes().

◆ P4

#define P4
Value:
a00, a12, a24, a31, a43, a42, a04, a11, a23, a30, a34, a41, \
a03, a10, a22, a21, a33, a40, a02, a14, a13, a20, a32, a44, a01

Definition at line 1147 of file keccak.c.

Referenced by SubBytes().

◆ P4_TO_P0

#define P4_TO_P0

Definition at line 1247 of file keccak.c.

◆ P5

#define P5
Value:
a00, a21, a42, a13, a34, a04, a20, a41, a12, a33, a03, a24, \
a40, a11, a32, a02, a23, a44, a10, a31, a01, a22, a43, a14, a30

Definition at line 1149 of file keccak.c.

Referenced by SubBytes().

◆ P6

#define P6
Value:
a00, a02, a04, a01, a03, a20, a22, a24, a21, a23, a40, a42, \
a44, a41, a43, a10, a12, a14, a11, a13, a30, a32, a34, a31, a33

Definition at line 1151 of file keccak.c.

Referenced by SubBytes().

◆ P6_TO_P0

#define P6_TO_P0

Definition at line 1279 of file keccak.c.

◆ P7

#define P7
Value:
a00, a10, a20, a30, a40, a22, a32, a42, a02, a12, a44, a04, \
a14, a24, a34, a11, a21, a31, a41, a01, a33, a43, a03, a13, a23

Definition at line 1153 of file keccak.c.

Referenced by SubBytes().

◆ P8

#define P8
Value:
a00, a11, a22, a33, a44, a32, a43, a04, a10, a21, a14, a20, \
a31, a42, a03, a41, a02, a13, a24, a30, a23, a34, a40, a01, a12

Definition at line 1155 of file keccak.c.

Referenced by SubBytes().

◆ P8_TO_P0

#define P8_TO_P0

Definition at line 1313 of file keccak.c.

◆ P9

#define P9
Value:
a00, a41, a32, a23, a14, a43, a34, a20, a11, a02, a31, a22, \
a13, a04, a40, a24, a10, a01, a42, a33, a12, a03, a44, a30, a21

Definition at line 1157 of file keccak.c.

Referenced by SubBytes().

◆ READ64

#define READ64 (   d,
  off 
)
Value:
do { \
sph_u32 tl, th; \
tl = sph_dec32le_aligned(buf + (off)); \
th = sph_dec32le_aligned(buf + (off) + 4); \
INTERLEAVE(tl, th); \
d ## l ^= tl; \
d ## h ^= th; \
} while (0)
static SPH_INLINE sph_u32 sph_dec32le_aligned(const void *src)
Decode a 32-bit value from the provided buffer (little endian convention).
Definition: sph_types.h:1615

Definition at line 655 of file keccak.c.

◆ READ_STATE

#define READ_STATE (   state)

Definition at line 549 of file keccak.c.

Referenced by keccak_core().

◆ RHO

#define RHO (   b00,
  b01,
  b02,
  b03,
  b04,
  b10,
  b11,
  b12,
  b13,
  b14,
  b20,
  b21,
  b22,
  b23,
  b24,
  b30,
  b31,
  b32,
  b33,
  b34,
  b40,
  b41,
  b42,
  b43,
  b44 
)
Value:
do { \
/* ROL64(b00, b00, 0); */ \
ROL64(b01, b01, 36); \
ROL64(b02, b02, 3); \
ROL64(b03, b03, 41); \
ROL64(b04, b04, 18); \
ROL64(b10, b10, 1); \
ROL64(b11, b11, 44); \
ROL64(b12, b12, 10); \
ROL64(b13, b13, 45); \
ROL64(b14, b14, 2); \
ROL64(b20, b20, 62); \
ROL64(b21, b21, 6); \
ROL64(b22, b22, 43); \
ROL64(b23, b23, 15); \
ROL64(b24, b24, 61); \
ROL64(b30, b30, 28); \
ROL64(b31, b31, 55); \
ROL64(b32, b32, 25); \
ROL64(b33, b33, 21); \
ROL64(b34, b34, 56); \
ROL64(b40, b40, 27); \
ROL64(b41, b41, 20); \
ROL64(b42, b42, 39); \
ROL64(b43, b43, 8); \
ROL64(b44, b44, 14); \
} while (0)

Definition at line 1016 of file keccak.c.

◆ ROL64

#define ROL64 (   d,
  v,
 
)    ROL64_ ## n(d, v)

Definition at line 768 of file keccak.c.

◆ ROL64_0

#define ROL64_0 (   d,
 
)

Definition at line 798 of file keccak.c.

◆ ROL64_1

#define ROL64_1 (   d,
 
)    ROL64_odd1(d, v)

Definition at line 799 of file keccak.c.

◆ ROL64_10

#define ROL64_10 (   d,
 
)    ROL64_even(d, v, 5)

Definition at line 808 of file keccak.c.

◆ ROL64_11

#define ROL64_11 (   d,
 
)    ROL64_odd( d, v, 6)

Definition at line 809 of file keccak.c.

◆ ROL64_12

#define ROL64_12 (   d,
 
)    ROL64_even(d, v, 6)

Definition at line 810 of file keccak.c.

◆ ROL64_13

#define ROL64_13 (   d,
 
)    ROL64_odd( d, v, 7)

Definition at line 811 of file keccak.c.

◆ ROL64_14

#define ROL64_14 (   d,
 
)    ROL64_even(d, v, 7)

Definition at line 812 of file keccak.c.

◆ ROL64_15

#define ROL64_15 (   d,
 
)    ROL64_odd( d, v, 8)

Definition at line 813 of file keccak.c.

◆ ROL64_16

#define ROL64_16 (   d,
 
)    ROL64_even(d, v, 8)

Definition at line 814 of file keccak.c.

◆ ROL64_17

#define ROL64_17 (   d,
 
)    ROL64_odd( d, v, 9)

Definition at line 815 of file keccak.c.

◆ ROL64_18

#define ROL64_18 (   d,
 
)    ROL64_even(d, v, 9)

Definition at line 816 of file keccak.c.

◆ ROL64_19

#define ROL64_19 (   d,
 
)    ROL64_odd( d, v, 10)

Definition at line 817 of file keccak.c.

◆ ROL64_2

#define ROL64_2 (   d,
 
)    ROL64_even(d, v, 1)

Definition at line 800 of file keccak.c.

◆ ROL64_20

#define ROL64_20 (   d,
 
)    ROL64_even(d, v, 10)

Definition at line 818 of file keccak.c.

◆ ROL64_21

#define ROL64_21 (   d,
 
)    ROL64_odd( d, v, 11)

Definition at line 819 of file keccak.c.

◆ ROL64_22

#define ROL64_22 (   d,
 
)    ROL64_even(d, v, 11)

Definition at line 820 of file keccak.c.

◆ ROL64_23

#define ROL64_23 (   d,
 
)    ROL64_odd( d, v, 12)

Definition at line 821 of file keccak.c.

◆ ROL64_24

#define ROL64_24 (   d,
 
)    ROL64_even(d, v, 12)

Definition at line 822 of file keccak.c.

◆ ROL64_25

#define ROL64_25 (   d,
 
)    ROL64_odd( d, v, 13)

Definition at line 823 of file keccak.c.

◆ ROL64_26

#define ROL64_26 (   d,
 
)    ROL64_even(d, v, 13)

Definition at line 824 of file keccak.c.

◆ ROL64_27

#define ROL64_27 (   d,
 
)    ROL64_odd( d, v, 14)

Definition at line 825 of file keccak.c.

◆ ROL64_28

#define ROL64_28 (   d,
 
)    ROL64_even(d, v, 14)

Definition at line 826 of file keccak.c.

◆ ROL64_29

#define ROL64_29 (   d,
 
)    ROL64_odd( d, v, 15)

Definition at line 827 of file keccak.c.

◆ ROL64_3

#define ROL64_3 (   d,
 
)    ROL64_odd( d, v, 2)

Definition at line 801 of file keccak.c.

◆ ROL64_30

#define ROL64_30 (   d,
 
)    ROL64_even(d, v, 15)

Definition at line 828 of file keccak.c.

◆ ROL64_31

#define ROL64_31 (   d,
 
)    ROL64_odd( d, v, 16)

Definition at line 829 of file keccak.c.

◆ ROL64_32

#define ROL64_32 (   d,
 
)    ROL64_even(d, v, 16)

Definition at line 830 of file keccak.c.

◆ ROL64_33

#define ROL64_33 (   d,
 
)    ROL64_odd( d, v, 17)

Definition at line 831 of file keccak.c.

◆ ROL64_34

#define ROL64_34 (   d,
 
)    ROL64_even(d, v, 17)

Definition at line 832 of file keccak.c.

◆ ROL64_35

#define ROL64_35 (   d,
 
)    ROL64_odd( d, v, 18)

Definition at line 833 of file keccak.c.

◆ ROL64_36

#define ROL64_36 (   d,
 
)    ROL64_even(d, v, 18)

Definition at line 834 of file keccak.c.

◆ ROL64_37

#define ROL64_37 (   d,
 
)    ROL64_odd( d, v, 19)

Definition at line 835 of file keccak.c.

◆ ROL64_38

#define ROL64_38 (   d,
 
)    ROL64_even(d, v, 19)

Definition at line 836 of file keccak.c.

◆ ROL64_39

#define ROL64_39 (   d,
 
)    ROL64_odd( d, v, 20)

Definition at line 837 of file keccak.c.

◆ ROL64_4

#define ROL64_4 (   d,
 
)    ROL64_even(d, v, 2)

Definition at line 802 of file keccak.c.

◆ ROL64_40

#define ROL64_40 (   d,
 
)    ROL64_even(d, v, 20)

Definition at line 838 of file keccak.c.

◆ ROL64_41

#define ROL64_41 (   d,
 
)    ROL64_odd( d, v, 21)

Definition at line 839 of file keccak.c.

◆ ROL64_42

#define ROL64_42 (   d,
 
)    ROL64_even(d, v, 21)

Definition at line 840 of file keccak.c.

◆ ROL64_43

#define ROL64_43 (   d,
 
)    ROL64_odd( d, v, 22)

Definition at line 841 of file keccak.c.

◆ ROL64_44

#define ROL64_44 (   d,
 
)    ROL64_even(d, v, 22)

Definition at line 842 of file keccak.c.

◆ ROL64_45

#define ROL64_45 (   d,
 
)    ROL64_odd( d, v, 23)

Definition at line 843 of file keccak.c.

◆ ROL64_46

#define ROL64_46 (   d,
 
)    ROL64_even(d, v, 23)

Definition at line 844 of file keccak.c.

◆ ROL64_47

#define ROL64_47 (   d,
 
)    ROL64_odd( d, v, 24)

Definition at line 845 of file keccak.c.

◆ ROL64_48

#define ROL64_48 (   d,
 
)    ROL64_even(d, v, 24)

Definition at line 846 of file keccak.c.

◆ ROL64_49

#define ROL64_49 (   d,
 
)    ROL64_odd( d, v, 25)

Definition at line 847 of file keccak.c.

◆ ROL64_5

#define ROL64_5 (   d,
 
)    ROL64_odd( d, v, 3)

Definition at line 803 of file keccak.c.

◆ ROL64_50

#define ROL64_50 (   d,
 
)    ROL64_even(d, v, 25)

Definition at line 848 of file keccak.c.

◆ ROL64_51

#define ROL64_51 (   d,
 
)    ROL64_odd( d, v, 26)

Definition at line 849 of file keccak.c.

◆ ROL64_52

#define ROL64_52 (   d,
 
)    ROL64_even(d, v, 26)

Definition at line 850 of file keccak.c.

◆ ROL64_53

#define ROL64_53 (   d,
 
)    ROL64_odd( d, v, 27)

Definition at line 851 of file keccak.c.

◆ ROL64_54

#define ROL64_54 (   d,
 
)    ROL64_even(d, v, 27)

Definition at line 852 of file keccak.c.

◆ ROL64_55

#define ROL64_55 (   d,
 
)    ROL64_odd( d, v, 28)

Definition at line 853 of file keccak.c.

◆ ROL64_56

#define ROL64_56 (   d,
 
)    ROL64_even(d, v, 28)

Definition at line 854 of file keccak.c.

◆ ROL64_57

#define ROL64_57 (   d,
 
)    ROL64_odd( d, v, 29)

Definition at line 855 of file keccak.c.

◆ ROL64_58

#define ROL64_58 (   d,
 
)    ROL64_even(d, v, 29)

Definition at line 856 of file keccak.c.

◆ ROL64_59

#define ROL64_59 (   d,
 
)    ROL64_odd( d, v, 30)

Definition at line 857 of file keccak.c.

◆ ROL64_6

#define ROL64_6 (   d,
 
)    ROL64_even(d, v, 3)

Definition at line 804 of file keccak.c.

◆ ROL64_60

#define ROL64_60 (   d,
 
)    ROL64_even(d, v, 30)

Definition at line 858 of file keccak.c.

◆ ROL64_61

#define ROL64_61 (   d,
 
)    ROL64_odd( d, v, 31)

Definition at line 859 of file keccak.c.

◆ ROL64_62

#define ROL64_62 (   d,
 
)    ROL64_even(d, v, 31)

Definition at line 860 of file keccak.c.

◆ ROL64_63

#define ROL64_63 (   d,
 
)    ROL64_odd63(d, v)

Definition at line 861 of file keccak.c.

◆ ROL64_7

#define ROL64_7 (   d,
 
)    ROL64_odd( d, v, 4)

Definition at line 805 of file keccak.c.

◆ ROL64_8

#define ROL64_8 (   d,
 
)    ROL64_even(d, v, 4)

Definition at line 806 of file keccak.c.

◆ ROL64_9

#define ROL64_9 (   d,
 
)    ROL64_odd( d, v, 5)

Definition at line 807 of file keccak.c.

◆ ROL64_even

#define ROL64_even (   d,
  v,
 
)
Value:
do { \
d ## l = SPH_T32(v ## l << n) | (v ## l >> (32 - n)); \
d ## h = SPH_T32(v ## h << n) | (v ## h >> (32 - n)); \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932

Definition at line 793 of file keccak.c.

◆ ROL64_odd

#define ROL64_odd (   d,
  v,
 
)
Value:
do { \
sph_u32 tmp; \
tmp = SPH_T32(v ## l << (n - 1)) | (v ## l >> (33 - n)); \
d ## l = SPH_T32(v ## h << n) | (v ## h >> (32 - n)); \
d ## h = tmp; \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932

Definition at line 786 of file keccak.c.

◆ ROL64_odd1

#define ROL64_odd1 (   d,
 
)
Value:
do { \
sph_u32 tmp; \
tmp = v ## l; \
d ## l = SPH_T32(v ## h << 1) | (v ## h >> 31); \
d ## h = tmp; \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932

Definition at line 772 of file keccak.c.

◆ ROL64_odd63

#define ROL64_odd63 (   d,
 
)
Value:
do { \
sph_u32 tmp; \
tmp = SPH_T32(v ## l << 31) | (v ## l >> 1); \
d ## l = v ## h; \
d ## h = tmp; \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932

Definition at line 779 of file keccak.c.

◆ RPAR

#define RPAR   )

Definition at line 1390 of file keccak.c.

◆ SPH_KECCAK_INTERLEAVE

#define SPH_KECCAK_INTERLEAVE   1

Definition at line 104 of file keccak.c.

◆ SPH_KECCAK_NOCOPY

#define SPH_KECCAK_NOCOPY   0

Definition at line 126 of file keccak.c.

◆ SPH_KECCAK_UNROLL

#define SPH_KECCAK_UNROLL   8

Definition at line 114 of file keccak.c.

◆ TH_ELT

#define TH_ELT (   t,
  c0,
  c1,
  c2,
  c3,
  c4,
  d0,
  d1,
  d2,
  d3,
  d4 
)
Value:
do { \
DECL64(tt0); \
DECL64(tt1); \
DECL64(tt2); \
DECL64(tt3); \
XOR64(tt0, d0, d1); \
XOR64(tt1, d2, d3); \
XOR64(tt0, tt0, d4); \
XOR64(tt0, tt0, tt1); \
ROL64(tt0, tt0, 1); \
XOR64(tt2, c0, c1); \
XOR64(tt3, c2, c3); \
XOR64(tt0, tt0, c4); \
XOR64(tt2, tt2, tt3); \
XOR64(t, tt0, tt2); \
} while (0)

Definition at line 958 of file keccak.c.

◆ THETA

#define THETA (   b00,
  b01,
  b02,
  b03,
  b04,
  b10,
  b11,
  b12,
  b13,
  b14,
  b20,
  b21,
  b22,
  b23,
  b24,
  b30,
  b31,
  b32,
  b33,
  b34,
  b40,
  b41,
  b42,
  b43,
  b44 
)

Definition at line 975 of file keccak.c.

◆ UNINTERLEAVE

#define UNINTERLEAVE (   xl,
  xh 
)
Value:
do { \
sph_u32 l, h, t; \
l = (xl); h = (xh); \
t = (l ^ SPH_T32(h << 16)) & SPH_C32(0xFFFF0000); \
l ^= t; h ^= t >> 16; \
t = (l ^ (l >> 8)) & SPH_C32(0x0000FF00); l ^= t ^ (t << 8); \
t = (h ^ (h >> 8)) & SPH_C32(0x0000FF00); h ^= t ^ (t << 8); \
t = (l ^ (l >> 4)) & SPH_C32(0x00F000F0); l ^= t ^ (t << 4); \
t = (h ^ (h >> 4)) & SPH_C32(0x00F000F0); h ^= t ^ (t << 4); \
t = (l ^ (l >> 2)) & SPH_C32(0x0C0C0C0C); l ^= t ^ (t << 2); \
t = (h ^ (h >> 2)) & SPH_C32(0x0C0C0C0C); h ^= t ^ (t << 2); \
t = (l ^ (l >> 1)) & SPH_C32(0x22222222); l ^= t ^ (t << 1); \
t = (h ^ (h >> 1)) & SPH_C32(0x22222222); h ^= t ^ (t << 1); \
(xl) = l; (xh) = h; \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932
#define SPH_C32(x)
Definition: sph_types.h:873

Definition at line 443 of file keccak.c.

◆ WRITE_STATE

#define WRITE_STATE (   state)

Definition at line 602 of file keccak.c.

Referenced by keccak_core().

◆ XOR64

#define XOR64 (   d,
  a,
 
)    (d ## l = a ## l ^ b ## l, d ## h = a ## h ^ b ## h)

Definition at line 764 of file keccak.c.

◆ XOR64_IOTA

#define XOR64_IOTA (   d,
  s,
 
)    (d ## l = s ## l ^ k.low, d ## h = s ## h ^ k.high)

Definition at line 953 of file keccak.c.

Function Documentation

◆ keccak_core()

static void keccak_core ( sph_keccak_context kc,
const void *  data,
size_t  len,
size_t  lim 
)
static

◆ keccak_init()

static void keccak_init ( sph_keccak_context kc,
unsigned  out_size 
)
static

◆ sph_keccak224()

void sph_keccak224 ( void *  cc,
const void *  data,
size_t  len 
)

Process some data bytes.

It is acceptable that len is zero (in which case this function does nothing).

Parameters
ccthe Keccak-224 context
datathe input data
lenthe input data length (in bytes)

Definition at line 1718 of file keccak.c.

References keccak_core().

◆ sph_keccak224_addbits_and_close()

void sph_keccak224_addbits_and_close ( void *  cc,
unsigned  ub,
unsigned  n,
void *  dst 
)

Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (28 bytes).

If bit number i in ub has value 2^i, then the extra bits are those numbered 7 downto 8-n (this is the big-endian convention at the byte level). The context is automatically reinitialized.

Parameters
ccthe Keccak-224 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 1732 of file keccak.c.

Referenced by sph_keccak224_close().

◆ sph_keccak224_close()

void sph_keccak224_close ( void *  cc,
void *  dst 
)

Terminate the current Keccak-224 computation and output the result into the provided buffer.

The destination buffer must be wide enough to accomodate the result (28 bytes). The context is automatically reinitialized.

Parameters
ccthe Keccak-224 context
dstthe destination buffer

Definition at line 1725 of file keccak.c.

References sph_keccak224_addbits_and_close().

◆ sph_keccak224_init()

void sph_keccak224_init ( void *  cc)

Initialize a Keccak-224 context.

This process performs no memory allocation.

Parameters
ccthe Keccak-224 context (pointer to a sph_keccak224_context)

Definition at line 1711 of file keccak.c.

References keccak_init().

◆ sph_keccak256()

void sph_keccak256 ( void *  cc,
const void *  data,
size_t  len 
)

Process some data bytes.

It is acceptable that len is zero (in which case this function does nothing).

Parameters
ccthe Keccak-256 context
datathe input data
lenthe input data length (in bytes)

Definition at line 1746 of file keccak.c.

References keccak_core().

◆ sph_keccak256_addbits_and_close()

void sph_keccak256_addbits_and_close ( void *  cc,
unsigned  ub,
unsigned  n,
void *  dst 
)

Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (32 bytes).

If bit number i in ub has value 2^i, then the extra bits are those numbered 7 downto 8-n (this is the big-endian convention at the byte level). The context is automatically reinitialized.

Parameters
ccthe Keccak-256 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 1760 of file keccak.c.

Referenced by sph_keccak256_close().

◆ sph_keccak256_close()

void sph_keccak256_close ( void *  cc,
void *  dst 
)

Terminate the current Keccak-256 computation and output the result into the provided buffer.

The destination buffer must be wide enough to accomodate the result (32 bytes). The context is automatically reinitialized.

Parameters
ccthe Keccak-256 context
dstthe destination buffer

Definition at line 1753 of file keccak.c.

References sph_keccak256_addbits_and_close().

◆ sph_keccak256_init()

void sph_keccak256_init ( void *  cc)

Initialize a Keccak-256 context.

This process performs no memory allocation.

Parameters
ccthe Keccak-256 context (pointer to a sph_keccak256_context)

Definition at line 1739 of file keccak.c.

References keccak_init().

◆ sph_keccak384()

void sph_keccak384 ( void *  cc,
const void *  data,
size_t  len 
)

Process some data bytes.

It is acceptable that len is zero (in which case this function does nothing).

Parameters
ccthe Keccak-384 context
datathe input data
lenthe input data length (in bytes)

Definition at line 1774 of file keccak.c.

References keccak_core().

◆ sph_keccak384_addbits_and_close()

void sph_keccak384_addbits_and_close ( void *  cc,
unsigned  ub,
unsigned  n,
void *  dst 
)

Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (48 bytes).

If bit number i in ub has value 2^i, then the extra bits are those numbered 7 downto 8-n (this is the big-endian convention at the byte level). The context is automatically reinitialized.

Parameters
ccthe Keccak-384 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 1788 of file keccak.c.

Referenced by sph_keccak384_close().

◆ sph_keccak384_close()

void sph_keccak384_close ( void *  cc,
void *  dst 
)

Terminate the current Keccak-384 computation and output the result into the provided buffer.

The destination buffer must be wide enough to accomodate the result (48 bytes). The context is automatically reinitialized.

Parameters
ccthe Keccak-384 context
dstthe destination buffer

Definition at line 1781 of file keccak.c.

References sph_keccak384_addbits_and_close().

◆ sph_keccak384_init()

void sph_keccak384_init ( void *  cc)

Initialize a Keccak-384 context.

This process performs no memory allocation.

Parameters
ccthe Keccak-384 context (pointer to a sph_keccak384_context)

Definition at line 1767 of file keccak.c.

References keccak_init().

◆ sph_keccak512()

void sph_keccak512 ( void *  cc,
const void *  data,
size_t  len 
)

Process some data bytes.

It is acceptable that len is zero (in which case this function does nothing).

Parameters
ccthe Keccak-512 context
datathe input data
lenthe input data length (in bytes)

Definition at line 1802 of file keccak.c.

References keccak_core().

Referenced by HashX11().

◆ sph_keccak512_addbits_and_close()

void sph_keccak512_addbits_and_close ( void *  cc,
unsigned  ub,
unsigned  n,
void *  dst 
)

Add a few additional bits (0 to 7) to the current computation, then terminate it and output the result in the provided buffer, which must be wide enough to accomodate the result (64 bytes).

If bit number i in ub has value 2^i, then the extra bits are those numbered 7 downto 8-n (this is the big-endian convention at the byte level). The context is automatically reinitialized.

Parameters
ccthe Keccak-512 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 1816 of file keccak.c.

Referenced by sph_keccak512_close().

◆ sph_keccak512_close()

void sph_keccak512_close ( void *  cc,
void *  dst 
)

Terminate the current Keccak-512 computation and output the result into the provided buffer.

The destination buffer must be wide enough to accomodate the result (64 bytes). The context is automatically reinitialized.

Parameters
ccthe Keccak-512 context
dstthe destination buffer

Definition at line 1809 of file keccak.c.

References sph_keccak512_addbits_and_close().

Referenced by HashX11().

◆ sph_keccak512_init()

void sph_keccak512_init ( void *  cc)

Initialize a Keccak-512 context.

This process performs no memory allocation.

Parameters
ccthe Keccak-512 context (pointer to a sph_keccak512_context)

Definition at line 1795 of file keccak.c.

References keccak_init().

Referenced by HashX11().

Variable Documentation

◆ high

◆ low

◆ RC

const { ... } RC[]
Released under the MIT license