Raven Core  3.0.0
P2P Digital Currency
Macros | Functions
sph_fugue.c File Reference
#include <stddef.h>
#include <string.h>
#include "sph_fugue.h"
Include dependency graph for sph_fugue.c:

Go to the source code of this file.

Macros

#define TIX2(q, x00, x01, x08, x10, x24)
 
#define TIX3(q, x00, x01, x04, x08, x16, x27, x30)
 
#define TIX4(q, x00, x01, x04, x07, x08, x22, x24, x27, x30)
 
#define CMIX30(x00, x01, x02, x04, x05, x06, x15, x16, x17)
 
#define CMIX36(x00, x01, x02, x04, x05, x06, x18, x19, x20)
 
#define SMIX(x0, x1, x2, x3)
 
#define DECL_STATE_SMALL
 
#define DECL_STATE_BIG
 
#define READ_STATE_SMALL(state)
 
#define READ_STATE_BIG(state)
 
#define WRITE_STATE_SMALL(state)
 
#define WRITE_STATE_BIG(state)
 
#define INCR_COUNTER
 
#define CORE_ENTRY
 
#define CORE_EXIT
 
#define NEXT(rc)
 
#define WRITE_COUNTER
 
#define CLOSE_ENTRY(s, rcm, core)
 
#define ROR(n, s)
 

Functions

void sph_fugue224_init (void *cc)
 
void sph_fugue224 (void *cc, const void *data, size_t len)
 
void sph_fugue224_close (void *cc, void *dst)
 
void sph_fugue224_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 
void sph_fugue256_init (void *cc)
 
void sph_fugue256 (void *cc, const void *data, size_t len)
 
void sph_fugue256_close (void *cc, void *dst)
 
void sph_fugue256_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 
void sph_fugue384_init (void *cc)
 
void sph_fugue384 (void *cc, const void *data, size_t len)
 
void sph_fugue384_close (void *cc, void *dst)
 
void sph_fugue384_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 
void sph_fugue512_init (void *cc)
 
void sph_fugue512 (void *cc, const void *data, size_t len)
 
void sph_fugue512_close (void *cc, void *dst)
 
void sph_fugue512_addbits_and_close (void *cc, unsigned ub, unsigned n, void *dst)
 

Macro Definition Documentation

◆ CLOSE_ENTRY

#define CLOSE_ENTRY (   s,
  rcm,
  core 
)
Value:
unsigned char buf[16]; \
unsigned plen, rms; \
unsigned char *out; \
sph_u32 S[s]; \
plen = sc->partial_len; \
WRITE_COUNTER; \
if (plen == 0 && n == 0) { \
plen = 4; \
} else if (plen < 4 || n != 0) { \
unsigned u; \
\
if (plen == 4) \
plen = 0; \
buf[plen] = ub & ~(0xFFU >> n); \
for (u = plen + 1; u < 4; u ++) \
buf[u] = 0; \
} \
core(sc, buf + plen, (sizeof buf) - plen); \
rms = sc->round_shift * (rcm); \
memcpy(S, sc->S + (s) - rms, rms * sizeof(sph_u32)); \
memcpy(S + rms, sc->S, ((s) - rms) * sizeof(sph_u32));
#define S(x0, x1, x2, x3, cb, r)
Definition: jh.c:494
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 933 of file sph_fugue.c.

◆ CMIX30

#define CMIX30 (   x00,
  x01,
  x02,
  x04,
  x05,
  x06,
  x15,
  x16,
  x17 
)
Value:
do { \
x00 ^= x04; \
x01 ^= x05; \
x02 ^= x06; \
x15 ^= x04; \
x16 ^= x05; \
x17 ^= x06; \
} while (0)

Definition at line 422 of file sph_fugue.c.

◆ CMIX36

#define CMIX36 (   x00,
  x01,
  x02,
  x04,
  x05,
  x06,
  x18,
  x19,
  x20 
)
Value:
do { \
x00 ^= x04; \
x01 ^= x05; \
x02 ^= x06; \
x18 ^= x04; \
x19 ^= x05; \
x20 ^= x06; \
} while (0)

Definition at line 431 of file sph_fugue.c.

◆ CORE_ENTRY

#define CORE_ENTRY
Value:
sph_u32 p; \
unsigned plen, rshift; \
INCR_COUNTER; \
p = sc->partial; \
plen = sc->partial_len; \
if (plen < 4) { \
unsigned count = 4 - plen; \
if (len < count) \
count = len; \
plen += count; \
while (count -- > 0) { \
p = (p << 8) | *(const unsigned char *)data; \
data = (const unsigned char *)data + 1; \
len --; \
} \
if (len == 0) { \
sc->partial = p; \
sc->partial_len = plen; \
return; \
} \
}
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 697 of file sph_fugue.c.

◆ CORE_EXIT

#define CORE_EXIT
Value:
p = 0; \
sc->partial_len = (unsigned)len; \
while (len -- > 0) { \
p = (p << 8) | *(const unsigned char *)data; \
data = (const unsigned char *)data + 1; \
} \
sc->partial = p; \
sc->round_shift = rshift;

Definition at line 720 of file sph_fugue.c.

◆ DECL_STATE_BIG

#define DECL_STATE_BIG
Value:
DECL_STATE_SMALL \
sph_u32 S30, S31, S32, S33, S34, S35;

Definition at line 566 of file sph_fugue.c.

◆ DECL_STATE_SMALL

#define DECL_STATE_SMALL
Value:
sph_u32 S00, S01, S02, S03, S04, S05, S06, S07, S08, S09; \
sph_u32 S10, S11, S12, S13, S14, S15, S16, S17, S18, S19; \
sph_u32 S20, S21, S22, S23, S24, S25, S26, S27, S28, S29;
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 561 of file sph_fugue.c.

◆ INCR_COUNTER

#define INCR_COUNTER
Value:
do { \
sph_u32 tmp = SPH_T32((sph_u32)len << 3); \
sc->bit_count_low = SPH_T32(sc->bit_count_low + tmp); \
if (sc->bit_count_low < tmp) \
sc->bit_count_high ++; \
sc->bit_count_high = SPH_T32(sc->bit_count_high \
+ ((sph_u32)len >> 29)); \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 686 of file sph_fugue.c.

◆ NEXT

#define NEXT (   rc)
Value:
if (len <= 4) { \
rshift = (rc); \
break; \
} \
p = sph_dec32be(data); \
data = (const unsigned char *)data + 4; \
len -= 4

Definition at line 733 of file sph_fugue.c.

◆ READ_STATE_BIG

#define READ_STATE_BIG (   state)
Value:
do { \
READ_STATE_SMALL(state); \
S30 = (state)->S[30]; \
S31 = (state)->S[31]; \
S32 = (state)->S[32]; \
S33 = (state)->S[33]; \
S34 = (state)->S[34]; \
S35 = (state)->S[35]; \
} while (0)
#define S(x0, x1, x2, x3, cb, r)
Definition: jh.c:494

Definition at line 603 of file sph_fugue.c.

◆ READ_STATE_SMALL

#define READ_STATE_SMALL (   state)

Definition at line 570 of file sph_fugue.c.

◆ ROR

#define ROR (   n,
 
)
Value:
do { \
sph_u32 tmp[n]; \
memcpy(tmp, S + ((s) - (n)), (n) * sizeof(sph_u32)); \
memmove(S + (n), S, ((s) - (n)) * sizeof(sph_u32)); \
memcpy(S, tmp, (n) * sizeof(sph_u32)); \
} while (0)
#define S(x0, x1, x2, x3, cb, r)
Definition: jh.c:494
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 956 of file sph_fugue.c.

◆ SMIX

#define SMIX (   x0,
  x1,
  x2,
  x3 
)

Definition at line 440 of file sph_fugue.c.

◆ TIX2

#define TIX2 (   q,
  x00,
  x01,
  x08,
  x10,
  x24 
)
Value:
do { \
x10 ^= x00; \
x00 = (q); \
x08 ^= x00; \
x01 ^= x24; \
} while (0)

Definition at line 398 of file sph_fugue.c.

◆ TIX3

#define TIX3 (   q,
  x00,
  x01,
  x04,
  x08,
  x16,
  x27,
  x30 
)
Value:
do { \
x16 ^= x00; \
x00 = (q); \
x08 ^= x00; \
x01 ^= x27; \
x04 ^= x30; \
} while (0)

Definition at line 405 of file sph_fugue.c.

◆ TIX4

#define TIX4 (   q,
  x00,
  x01,
  x04,
  x07,
  x08,
  x22,
  x24,
  x27,
  x30 
)
Value:
do { \
x22 ^= x00; \
x00 = (q); \
x08 ^= x00; \
x01 ^= x24; \
x04 ^= x27; \
x07 ^= x30; \
} while (0)

Definition at line 413 of file sph_fugue.c.

◆ WRITE_COUNTER

#define WRITE_COUNTER
Value:
do { \
sph_enc32be(buf + 4, sc->bit_count_high); \
sph_enc32be(buf + 8, sc->bit_count_low + n); \
} while (0)

Definition at line 926 of file sph_fugue.c.

◆ WRITE_STATE_BIG

#define WRITE_STATE_BIG (   state)
Value:
do { \
WRITE_STATE_SMALL(state); \
(state)->S[30] = S30; \
(state)->S[31] = S31; \
(state)->S[32] = S32; \
(state)->S[33] = S33; \
(state)->S[34] = S34; \
(state)->S[35] = S35; \
} while (0)
#define S(x0, x1, x2, x3, cb, r)
Definition: jh.c:494

Definition at line 646 of file sph_fugue.c.

◆ WRITE_STATE_SMALL

#define WRITE_STATE_SMALL (   state)

Definition at line 613 of file sph_fugue.c.

Function Documentation

◆ sph_fugue224()

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

Definition at line 1118 of file sph_fugue.c.

◆ sph_fugue224_addbits_and_close()

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

Definition at line 1130 of file sph_fugue.c.

◆ sph_fugue224_close()

void sph_fugue224_close ( void *  cc,
void *  dst 
)

Definition at line 1124 of file sph_fugue.c.

◆ sph_fugue224_init()

void sph_fugue224_init ( void *  cc)

Definition at line 1112 of file sph_fugue.c.

◆ sph_fugue256()

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

Definition at line 1142 of file sph_fugue.c.

◆ sph_fugue256_addbits_and_close()

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

Definition at line 1154 of file sph_fugue.c.

◆ sph_fugue256_close()

void sph_fugue256_close ( void *  cc,
void *  dst 
)

Definition at line 1148 of file sph_fugue.c.

◆ sph_fugue256_init()

void sph_fugue256_init ( void *  cc)

Definition at line 1136 of file sph_fugue.c.

◆ sph_fugue384()

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

Definition at line 1166 of file sph_fugue.c.

◆ sph_fugue384_addbits_and_close()

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

Definition at line 1178 of file sph_fugue.c.

◆ sph_fugue384_close()

void sph_fugue384_close ( void *  cc,
void *  dst 
)

Definition at line 1172 of file sph_fugue.c.

◆ sph_fugue384_init()

void sph_fugue384_init ( void *  cc)

Definition at line 1160 of file sph_fugue.c.

◆ sph_fugue512()

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

Definition at line 1190 of file sph_fugue.c.

Here is the caller graph for this function:

◆ sph_fugue512_addbits_and_close()

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

Definition at line 1202 of file sph_fugue.c.

◆ sph_fugue512_close()

void sph_fugue512_close ( void *  cc,
void *  dst 
)

Definition at line 1196 of file sph_fugue.c.

Here is the caller graph for this function:

◆ sph_fugue512_init()

void sph_fugue512_init ( void *  cc)

Definition at line 1184 of file sph_fugue.c.

Here is the caller graph for this function: