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

Go to the source code of this file.

Macros

#define SPH_HAMSI_EXPAND_SMALL   8
 
#define SPH_HAMSI_EXPAND_BIG   8
 
#define DECL_STATE_SMALL   sph_u32 c0, c1, c2, c3, c4, c5, c6, c7;
 
#define READ_STATE_SMALL(sc)
 
#define WRITE_STATE_SMALL(sc)
 
#define s0   m0
 
#define s1   m1
 
#define s2   c0
 
#define s3   c1
 
#define s4   c2
 
#define s5   c3
 
#define s6   m2
 
#define s7   m3
 
#define s8   m4
 
#define s9   m5
 
#define sA   c4
 
#define sB   c5
 
#define sC   c6
 
#define sD   c7
 
#define sE   m6
 
#define sF   m7
 
#define SBOX(a, b, c, d)
 
#define L(a, b, c, d)
 
#define ROUND_SMALL(rc, alpha)
 
#define P_SMALL
 
#define PF_SMALL
 
#define T_SMALL
 
#define DECL_STATE_BIG
 
#define READ_STATE_BIG(sc)
 
#define WRITE_STATE_BIG(sc)
 
#define s00   m0
 
#define s01   m1
 
#define s02   c0
 
#define s03   c1
 
#define s04   m2
 
#define s05   m3
 
#define s06   c2
 
#define s07   c3
 
#define s08   c4
 
#define s09   c5
 
#define s0A   m4
 
#define s0B   m5
 
#define s0C   c6
 
#define s0D   c7
 
#define s0E   m6
 
#define s0F   m7
 
#define s10   m8
 
#define s11   m9
 
#define s12   c8
 
#define s13   c9
 
#define s14   mA
 
#define s15   mB
 
#define s16   cA
 
#define s17   cB
 
#define s18   cC
 
#define s19   cD
 
#define s1A   mC
 
#define s1B   mD
 
#define s1C   cE
 
#define s1D   cF
 
#define s1E   mE
 
#define s1F   mF
 
#define ROUND_BIG(rc, alpha)
 
#define P_BIG
 
#define PF_BIG
 
#define T_BIG
 

Functions

void sph_hamsi224_init (void *cc)
 Initialize a Hamsi-224 context. More...
 
void sph_hamsi224 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_hamsi224_close (void *cc, void *dst)
 Terminate the current Hamsi-224 computation and output the result into the provided buffer. More...
 
void sph_hamsi224_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_hamsi256_init (void *cc)
 Initialize a Hamsi-256 context. More...
 
void sph_hamsi256 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_hamsi256_close (void *cc, void *dst)
 Terminate the current Hamsi-256 computation and output the result into the provided buffer. More...
 
void sph_hamsi256_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_hamsi384_init (void *cc)
 Initialize a Hamsi-384 context. More...
 
void sph_hamsi384 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_hamsi384_close (void *cc, void *dst)
 Terminate the current Hamsi-384 computation and output the result into the provided buffer. More...
 
void sph_hamsi384_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_hamsi512_init (void *cc)
 Initialize a Hamsi-512 context. More...
 
void sph_hamsi512 (void *cc, const void *data, size_t len)
 Process some data bytes. More...
 
void sph_hamsi512_close (void *cc, void *dst)
 Terminate the current Hamsi-512 computation and output the result into the provided buffer. More...
 
void sph_hamsi512_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...
 

Macro Definition Documentation

◆ DECL_STATE_BIG

#define DECL_STATE_BIG
Value:
sph_u32 c0, c1, c2, c3, c4, c5, c6, c7; \
sph_u32 c8, c9, cA, cB, cC, cD, cE, cF;
unsigned long sph_u32
Definition: sph_types.h:870

Definition at line 428 of file sph_hamsi.c.

◆ DECL_STATE_SMALL

#define DECL_STATE_SMALL   sph_u32 c0, c1, c2, c3, c4, c5, c6, c7;

Definition at line 187 of file sph_hamsi.c.

◆ L

#define L (   a,
  b,
  c,
 
)
Value:
do { \
(a) = SPH_ROTL32(a, 13); \
(c) = SPH_ROTL32(c, 3); \
(b) ^= (a) ^ (c); \
(d) ^= (c) ^ SPH_T32((a) << 3); \
(b) = SPH_ROTL32(b, 1); \
(d) = SPH_ROTL32(d, 7); \
(a) ^= (b) ^ (d); \
(c) ^= (d) ^ SPH_T32((b) << 7); \
(a) = SPH_ROTL32(a, 5); \
(c) = SPH_ROTL32(c, 22); \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932
#define SPH_ROTL32(x, n)
Definition: sph_types.h:933

Definition at line 252 of file sph_hamsi.c.

◆ P_BIG

#define P_BIG
Value:
do { \
ROUND_BIG(0, alpha_n); \
ROUND_BIG(1, alpha_n); \
ROUND_BIG(2, alpha_n); \
ROUND_BIG(3, alpha_n); \
ROUND_BIG(4, alpha_n); \
ROUND_BIG(5, alpha_n); \
} while (0)

Definition at line 574 of file sph_hamsi.c.

◆ P_SMALL

#define P_SMALL
Value:
do { \
ROUND_SMALL(0, alpha_n); \
ROUND_SMALL(1, alpha_n); \
ROUND_SMALL(2, alpha_n); \
} while (0)

Definition at line 292 of file sph_hamsi.c.

◆ PF_BIG

#define PF_BIG
Value:
do { \
ROUND_BIG(0, alpha_f); \
ROUND_BIG(1, alpha_f); \
ROUND_BIG(2, alpha_f); \
ROUND_BIG(3, alpha_f); \
ROUND_BIG(4, alpha_f); \
ROUND_BIG(5, alpha_f); \
ROUND_BIG(6, alpha_f); \
ROUND_BIG(7, alpha_f); \
ROUND_BIG(8, alpha_f); \
ROUND_BIG(9, alpha_f); \
ROUND_BIG(10, alpha_f); \
ROUND_BIG(11, alpha_f); \
} while (0)

Definition at line 583 of file sph_hamsi.c.

◆ PF_SMALL

#define PF_SMALL
Value:
do { \
ROUND_SMALL(0, alpha_f); \
ROUND_SMALL(1, alpha_f); \
ROUND_SMALL(2, alpha_f); \
ROUND_SMALL(3, alpha_f); \
ROUND_SMALL(4, alpha_f); \
ROUND_SMALL(5, alpha_f); \
} while (0)

Definition at line 298 of file sph_hamsi.c.

◆ READ_STATE_BIG

#define READ_STATE_BIG (   sc)
Value:
do { \
c0 = sc->h[0x0]; \
c1 = sc->h[0x1]; \
c2 = sc->h[0x2]; \
c3 = sc->h[0x3]; \
c4 = sc->h[0x4]; \
c5 = sc->h[0x5]; \
c6 = sc->h[0x6]; \
c7 = sc->h[0x7]; \
c8 = sc->h[0x8]; \
c9 = sc->h[0x9]; \
cA = sc->h[0xA]; \
cB = sc->h[0xB]; \
cC = sc->h[0xC]; \
cD = sc->h[0xD]; \
cE = sc->h[0xE]; \
cF = sc->h[0xF]; \
} while (0)

Definition at line 432 of file sph_hamsi.c.

◆ READ_STATE_SMALL

#define READ_STATE_SMALL (   sc)
Value:
do { \
c0 = sc->h[0x0]; \
c1 = sc->h[0x1]; \
c2 = sc->h[0x2]; \
c3 = sc->h[0x3]; \
c4 = sc->h[0x4]; \
c5 = sc->h[0x5]; \
c6 = sc->h[0x6]; \
c7 = sc->h[0x7]; \
} while (0)

Definition at line 190 of file sph_hamsi.c.

◆ ROUND_BIG

#define ROUND_BIG (   rc,
  alpha 
)

Definition at line 503 of file sph_hamsi.c.

◆ ROUND_SMALL

#define ROUND_SMALL (   rc,
  alpha 
)
Value:
do { \
s0 ^= alpha[0x00]; \
s1 ^= alpha[0x01] ^ (sph_u32)(rc); \
s2 ^= alpha[0x02]; \
s3 ^= alpha[0x03]; \
s4 ^= alpha[0x08]; \
s5 ^= alpha[0x09]; \
s6 ^= alpha[0x0A]; \
s7 ^= alpha[0x0B]; \
s8 ^= alpha[0x10]; \
s9 ^= alpha[0x11]; \
sA ^= alpha[0x12]; \
sB ^= alpha[0x13]; \
sC ^= alpha[0x18]; \
sD ^= alpha[0x19]; \
sE ^= alpha[0x1A]; \
sF ^= alpha[0x1B]; \
SBOX(s0, s4, s8, sC); \
SBOX(s1, s5, s9, sD); \
SBOX(s2, s6, sA, sE); \
SBOX(s3, s7, sB, sF); \
L(s0, s5, sA, sF); \
L(s1, s6, sB, sC); \
L(s2, s7, s8, sD); \
L(s3, s4, s9, sE); \
} while (0)
#define s2
Definition: sph_hamsi.c:214
#define s4
Definition: sph_hamsi.c:216
#define sC
Definition: sph_hamsi.c:224
#define s7
Definition: sph_hamsi.c:219
#define sD
Definition: sph_hamsi.c:225
#define s9
Definition: sph_hamsi.c:221
#define sA
Definition: sph_hamsi.c:222
#define s5
Definition: sph_hamsi.c:217
#define sF
Definition: sph_hamsi.c:227
#define s6
Definition: sph_hamsi.c:218
#define s1
Definition: sph_hamsi.c:213
unsigned long sph_u32
Definition: sph_types.h:870
#define s3
Definition: sph_hamsi.c:215
#define s8
Definition: sph_hamsi.c:220
#define s0
Definition: sph_hamsi.c:212
#define sB
Definition: sph_hamsi.c:223
#define sE
Definition: sph_hamsi.c:226

Definition at line 265 of file sph_hamsi.c.

◆ s0

#define s0   m0

Definition at line 212 of file sph_hamsi.c.

◆ s00

#define s00   m0

Definition at line 470 of file sph_hamsi.c.

◆ s01

#define s01   m1

Definition at line 471 of file sph_hamsi.c.

◆ s02

#define s02   c0

Definition at line 472 of file sph_hamsi.c.

◆ s03

#define s03   c1

Definition at line 473 of file sph_hamsi.c.

◆ s04

#define s04   m2

Definition at line 474 of file sph_hamsi.c.

◆ s05

#define s05   m3

Definition at line 475 of file sph_hamsi.c.

◆ s06

#define s06   c2

Definition at line 476 of file sph_hamsi.c.

◆ s07

#define s07   c3

Definition at line 477 of file sph_hamsi.c.

◆ s08

#define s08   c4

Definition at line 478 of file sph_hamsi.c.

◆ s09

#define s09   c5

Definition at line 479 of file sph_hamsi.c.

◆ s0A

#define s0A   m4

Definition at line 480 of file sph_hamsi.c.

◆ s0B

#define s0B   m5

Definition at line 481 of file sph_hamsi.c.

◆ s0C

#define s0C   c6

Definition at line 482 of file sph_hamsi.c.

◆ s0D

#define s0D   c7

Definition at line 483 of file sph_hamsi.c.

◆ s0E

#define s0E   m6

Definition at line 484 of file sph_hamsi.c.

◆ s0F

#define s0F   m7

Definition at line 485 of file sph_hamsi.c.

◆ s1

#define s1   m1

Definition at line 213 of file sph_hamsi.c.

◆ s10

#define s10   m8

Definition at line 486 of file sph_hamsi.c.

◆ s11

#define s11   m9

Definition at line 487 of file sph_hamsi.c.

◆ s12

#define s12   c8

Definition at line 488 of file sph_hamsi.c.

◆ s13

#define s13   c9

Definition at line 489 of file sph_hamsi.c.

◆ s14

#define s14   mA

Definition at line 490 of file sph_hamsi.c.

◆ s15

#define s15   mB

Definition at line 491 of file sph_hamsi.c.

◆ s16

#define s16   cA

Definition at line 492 of file sph_hamsi.c.

◆ s17

#define s17   cB

Definition at line 493 of file sph_hamsi.c.

◆ s18

#define s18   cC

Definition at line 494 of file sph_hamsi.c.

◆ s19

#define s19   cD

Definition at line 495 of file sph_hamsi.c.

◆ s1A

#define s1A   mC

Definition at line 496 of file sph_hamsi.c.

◆ s1B

#define s1B   mD

Definition at line 497 of file sph_hamsi.c.

◆ s1C

#define s1C   cE

Definition at line 498 of file sph_hamsi.c.

◆ s1D

#define s1D   cF

Definition at line 499 of file sph_hamsi.c.

◆ s1E

#define s1E   mE

Definition at line 500 of file sph_hamsi.c.

◆ s1F

#define s1F   mF

Definition at line 501 of file sph_hamsi.c.

◆ s2

#define s2   c0

Definition at line 214 of file sph_hamsi.c.

◆ s3

#define s3   c1

Definition at line 215 of file sph_hamsi.c.

◆ s4

#define s4   c2

Definition at line 216 of file sph_hamsi.c.

◆ s5

#define s5   c3

Definition at line 217 of file sph_hamsi.c.

◆ s6

#define s6   m2

Definition at line 218 of file sph_hamsi.c.

◆ s7

#define s7   m3

Definition at line 219 of file sph_hamsi.c.

◆ s8

#define s8   m4

Definition at line 220 of file sph_hamsi.c.

◆ s9

#define s9   m5

Definition at line 221 of file sph_hamsi.c.

◆ sA

#define sA   c4

Definition at line 222 of file sph_hamsi.c.

◆ sB

#define sB   c5

Definition at line 223 of file sph_hamsi.c.

◆ SBOX

#define SBOX (   a,
  b,
  c,
 
)
Value:
do { \
sph_u32 t; \
t = (a); \
(a) &= (c); \
(a) ^= (d); \
(c) ^= (b); \
(c) ^= (a); \
(d) |= t; \
(d) ^= (b); \
t ^= (c); \
(b) = (d); \
(d) |= t; \
(d) ^= (a); \
(a) &= (b); \
t ^= (a); \
(b) ^= (d); \
(b) ^= t; \
(a) = (c); \
(c) = (b); \
(b) = (d); \
(d) = SPH_T32(~t); \
} while (0)
#define SPH_T32(x)
Definition: sph_types.h:932

Definition at line 229 of file sph_hamsi.c.

◆ sC

#define sC   c6

Definition at line 224 of file sph_hamsi.c.

◆ sD

#define sD   c7

Definition at line 225 of file sph_hamsi.c.

◆ sE

#define sE   m6

Definition at line 226 of file sph_hamsi.c.

◆ sF

#define sF   m7

Definition at line 227 of file sph_hamsi.c.

◆ SPH_HAMSI_EXPAND_BIG

#define SPH_HAMSI_EXPAND_BIG   8

Definition at line 108 of file sph_hamsi.c.

◆ SPH_HAMSI_EXPAND_SMALL

#define SPH_HAMSI_EXPAND_SMALL   8

Definition at line 103 of file sph_hamsi.c.

◆ T_BIG

#define T_BIG
Value:
do { \
/* order is important */ \
cF = (sc->h[0xF] ^= s17); \
cE = (sc->h[0xE] ^= s16); \
cD = (sc->h[0xD] ^= s15); \
cC = (sc->h[0xC] ^= s14); \
cB = (sc->h[0xB] ^= s13); \
cA = (sc->h[0xA] ^= s12); \
c9 = (sc->h[0x9] ^= s11); \
c8 = (sc->h[0x8] ^= s10); \
c7 = (sc->h[0x7] ^= s07); \
c6 = (sc->h[0x6] ^= s06); \
c5 = (sc->h[0x5] ^= s05); \
c4 = (sc->h[0x4] ^= s04); \
c3 = (sc->h[0x3] ^= s03); \
c2 = (sc->h[0x2] ^= s02); \
c1 = (sc->h[0x1] ^= s01); \
c0 = (sc->h[0x0] ^= s00); \
} while (0)
#define s11
Definition: sph_hamsi.c:487
#define s06
Definition: sph_hamsi.c:476
#define s00
Definition: sph_hamsi.c:470
#define s15
Definition: sph_hamsi.c:491
#define s05
Definition: sph_hamsi.c:475
#define s13
Definition: sph_hamsi.c:489
#define s02
Definition: sph_hamsi.c:472
#define s17
Definition: sph_hamsi.c:493
#define s12
Definition: sph_hamsi.c:488
#define s03
Definition: sph_hamsi.c:473
#define s07
Definition: sph_hamsi.c:477
#define s01
Definition: sph_hamsi.c:471
#define s14
Definition: sph_hamsi.c:490
#define s04
Definition: sph_hamsi.c:474
#define s16
Definition: sph_hamsi.c:492
#define s10
Definition: sph_hamsi.c:486

Definition at line 600 of file sph_hamsi.c.

◆ T_SMALL

#define T_SMALL
Value:
do { \
/* order is important */ \
c7 = (sc->h[7] ^= sB); \
c6 = (sc->h[6] ^= sA); \
c5 = (sc->h[5] ^= s9); \
c4 = (sc->h[4] ^= s8); \
c3 = (sc->h[3] ^= s3); \
c2 = (sc->h[2] ^= s2); \
c1 = (sc->h[1] ^= s1); \
c0 = (sc->h[0] ^= s0); \
} while (0)
#define s2
Definition: sph_hamsi.c:214
#define s9
Definition: sph_hamsi.c:221
#define sA
Definition: sph_hamsi.c:222
#define s1
Definition: sph_hamsi.c:213
#define s3
Definition: sph_hamsi.c:215
#define s8
Definition: sph_hamsi.c:220
#define s0
Definition: sph_hamsi.c:212
#define sB
Definition: sph_hamsi.c:223

Definition at line 307 of file sph_hamsi.c.

◆ WRITE_STATE_BIG

#define WRITE_STATE_BIG (   sc)
Value:
do { \
sc->h[0x0] = c0; \
sc->h[0x1] = c1; \
sc->h[0x2] = c2; \
sc->h[0x3] = c3; \
sc->h[0x4] = c4; \
sc->h[0x5] = c5; \
sc->h[0x6] = c6; \
sc->h[0x7] = c7; \
sc->h[0x8] = c8; \
sc->h[0x9] = c9; \
sc->h[0xA] = cA; \
sc->h[0xB] = cB; \
sc->h[0xC] = cC; \
sc->h[0xD] = cD; \
sc->h[0xE] = cE; \
sc->h[0xF] = cF; \
} while (0)

Definition at line 451 of file sph_hamsi.c.

◆ WRITE_STATE_SMALL

#define WRITE_STATE_SMALL (   sc)
Value:
do { \
sc->h[0x0] = c0; \
sc->h[0x1] = c1; \
sc->h[0x2] = c2; \
sc->h[0x3] = c3; \
sc->h[0x4] = c4; \
sc->h[0x5] = c5; \
sc->h[0x6] = c6; \
sc->h[0x7] = c7; \
} while (0)

Definition at line 201 of file sph_hamsi.c.

Function Documentation

◆ sph_hamsi224()

void sph_hamsi224 ( 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 Hamsi-224 context
datathe input data
lenthe input data length (in bytes)

Definition at line 754 of file sph_hamsi.c.

◆ sph_hamsi224_addbits_and_close()

void sph_hamsi224_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 Hamsi-224 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 769 of file sph_hamsi.c.

◆ sph_hamsi224_close()

void sph_hamsi224_close ( void *  cc,
void *  dst 
)

Terminate the current Hamsi-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 Hamsi-224 context
dstthe destination buffer

Definition at line 761 of file sph_hamsi.c.

◆ sph_hamsi224_init()

void sph_hamsi224_init ( void *  cc)

Initialize a Hamsi-224 context.

This process performs no memory allocation.

Parameters
ccthe Hamsi-224 context (pointer to a sph_hamsi224_context)

Definition at line 747 of file sph_hamsi.c.

◆ sph_hamsi256()

void sph_hamsi256 ( 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 Hamsi-256 context
datathe input data
lenthe input data length (in bytes)

Definition at line 784 of file sph_hamsi.c.

◆ sph_hamsi256_addbits_and_close()

void sph_hamsi256_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 Hamsi-256 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 799 of file sph_hamsi.c.

◆ sph_hamsi256_close()

void sph_hamsi256_close ( void *  cc,
void *  dst 
)

Terminate the current Hamsi-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 Hamsi-256 context
dstthe destination buffer

Definition at line 791 of file sph_hamsi.c.

◆ sph_hamsi256_init()

void sph_hamsi256_init ( void *  cc)

Initialize a Hamsi-256 context.

This process performs no memory allocation.

Parameters
ccthe Hamsi-256 context (pointer to a sph_hamsi256_context)

Definition at line 777 of file sph_hamsi.c.

◆ sph_hamsi384()

void sph_hamsi384 ( 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 Hamsi-384 context
datathe input data
lenthe input data length (in bytes)

Definition at line 814 of file sph_hamsi.c.

◆ sph_hamsi384_addbits_and_close()

void sph_hamsi384_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 Hamsi-384 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 829 of file sph_hamsi.c.

◆ sph_hamsi384_close()

void sph_hamsi384_close ( void *  cc,
void *  dst 
)

Terminate the current Hamsi-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 Hamsi-384 context
dstthe destination buffer

Definition at line 821 of file sph_hamsi.c.

◆ sph_hamsi384_init()

void sph_hamsi384_init ( void *  cc)

Initialize a Hamsi-384 context.

This process performs no memory allocation.

Parameters
ccthe Hamsi-384 context (pointer to a sph_hamsi384_context)

Definition at line 807 of file sph_hamsi.c.

◆ sph_hamsi512()

void sph_hamsi512 ( 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 Hamsi-512 context
datathe input data
lenthe input data length (in bytes)

Definition at line 844 of file sph_hamsi.c.

Here is the caller graph for this function:

◆ sph_hamsi512_addbits_and_close()

void sph_hamsi512_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 Hamsi-512 context
ubthe extra bits
nthe number of extra bits (0 to 7)
dstthe destination buffer

Definition at line 859 of file sph_hamsi.c.

◆ sph_hamsi512_close()

void sph_hamsi512_close ( void *  cc,
void *  dst 
)

Terminate the current Hamsi-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 Hamsi-512 context
dstthe destination buffer

Definition at line 851 of file sph_hamsi.c.

Here is the caller graph for this function:

◆ sph_hamsi512_init()

void sph_hamsi512_init ( void *  cc)

Initialize a Hamsi-512 context.

This process performs no memory allocation.

Parameters
ccthe Hamsi-512 context (pointer to a sph_hamsi512_context)

Definition at line 837 of file sph_hamsi.c.

Here is the caller graph for this function: