Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

tiger.c File Reference

#include <stdint.h>
#include "tiger.h"

Defines

#define BIG_ENDIAN
#define PASSES   3
#define t1   (table)
#define t2   (table+256)
#define t3   (table+256*2)
#define t4   (table+256*3)
#define save_abc
#define round(a, b, c, x, mul)
#define pass(a, b, c, mul)
#define key_schedule
#define feedforward
#define compres
#define tiger_compres_macro(str64, state)

Functions

void tiger_compres (const uint64_t *str64, uint64_t state[3])
void tiger (const uint8_t *str, uint64_t length, uint8_t res[24])
 Tiger hash function.

Variables

static uint64_t table [4 *256]

Define Documentation

#define BIG_ENDIAN
 

#define compres
 

Value:

save_abc \
      for(pass_no=0; pass_no<PASSES; pass_no++) { \
        if(pass_no != 0) {key_schedule} \
        pass(a,b,c,(pass_no==0?5:pass_no==1?7:9)); \
        tmpa=a; a=c; c=b; b=tmpa;} \
      feedforward

#define feedforward
 

Value:

a ^= aa; \
      b -= bb; \
      c += cc;

#define key_schedule
 

Value:

x0 -= x7 ^ 0xA5A5A5A5A5A5A5A5LL; \
      x1 ^= x0; \
      x2 += x1; \
      x3 -= x2 ^ ((~x1)<<19); \
      x4 ^= x3; \
      x5 += x4; \
      x6 -= x5 ^ ((~x4)>>23); \
      x7 ^= x6; \
      x0 += x7; \
      x1 -= x0 ^ ((~x7)<<19); \
      x2 ^= x1; \
      x3 += x2; \
      x4 -= x3 ^ ((~x2)>>23); \
      x5 ^= x4; \
      x6 += x5; \
      x7 -= x6 ^ 0x0123456789ABCDEFLL;

#define pass a,
b,
c,
mul   ) 
 

Value:

round(a,b,c,x0,mul) \
      round(b,c,a,x1,mul) \
      round(c,a,b,x2,mul) \
      round(a,b,c,x3,mul) \
      round(b,c,a,x4,mul) \
      round(c,a,b,x5,mul) \
      round(a,b,c,x6,mul) \
      round(b,c,a,x7,mul)

#define PASSES   3
 

#define round a,
b,
c,
x,
mul   ) 
 

Value:

c ^= x; \
      a -= t1[(uint8_t)(c)] ^ \
           t2[(uint8_t)(((uint32_t)(c))>>(2*8))] ^ \
           t3[(uint8_t)((c)>>(4*8))] ^ \
           t4[(uint8_t)(((uint32_t)((c)>>(4*8)))>>(2*8))] ; \
      b += t4[(uint8_t)(((uint32_t)(c))>>(1*8))] ^ \
           t3[(uint8_t)(((uint32_t)(c))>>(3*8))] ^ \
           t2[(uint8_t)(((uint32_t)((c)>>(4*8)))>>(1*8))] ^ \
           t1[(uint8_t)(((uint32_t)((c)>>(4*8)))>>(3*8))]; \
      b *= mul;

#define save_abc
 

Value:

aa = a; \
      bb = b; \
      cc = c;

#define t1   (table)
 

#define t2   (table+256)
 

#define t3   (table+256*2)
 

#define t4   (table+256*3)
 

#define tiger_compres_macro str64,
state   ) 
 

Value:

{ \
  register uint64_t a, b, c, tmpa; \
  uint64_t aa, bb, cc; \
  register uint64_t x0, x1, x2, x3, x4, x5, x6, x7; \
  /*register uint32_t i*/; \
  int pass_no; \
\
  a = state[0]; \
  b = state[1]; \
  c = state[2]; \
\
  x0=str64[0]; x1=str64[1]; x2=str64[2]; x3=str64[3]; \
  x4=str64[4]; x5=str64[5]; x6=str64[6]; x7=str64[7]; \
\
  compres; \
\
  state[0] = a; \
  state[1] = b; \
  state[2] = c; \
}


Function Documentation

void tiger const uint8_t *  str,
uint64_t  length,
uint8_t  res[24]
 

Tiger hash function.

Parameters:
*str data to perform hash
length str length
res result 24 bytes array

void tiger_compres const uint64_t *  str64,
uint64_t  state[3]
 


Variable Documentation

uint64_t table[4 *256] [static]
 


Project hosted by: SourceForge.net Logo