Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

tiger.c File Reference


Detailed Description

Tiger hash.

This file comes from http://www.cs.technion.ac.il/~biham/Reports/Tiger/

Inclusion in gtk-gnutella is:

Author:
Jeroen Asselman
Date:
2003

#include "common.h"
#include "endian.h"
#include "misc.h"
#include "base32.h"
#include "tiger.h"
#include "override.h"
#include "tiger_sboxes.h"

Defines

#define PASSES   3
#define U64_FROM_2xU32(hi, lo)   (((guint64) (hi) << 32) | (lo))
#define t1   (tiger_sboxes)
#define t2   (&tiger_sboxes[256])
#define t3   (&tiger_sboxes[256*2])
#define t4   (&tiger_sboxes[256*3])
#define save_abc
#define round(a, b, c, x, mul)
#define pass(a, b, c, mul)
#define key_schedule
#define feedforward
#define compress
#define tiger_compress_macro(str, state)

Functions

void tiger_compress (const guint64 *data, guint64 state[3])
void tiger (gconstpointer data, guint64 length, gchar hash[24])
void tiger_check (void)
 Runs some test cases to check whether the implementation of the tiger hash algorithm is alright.


Define Documentation

#define compress
 

Value:

save_abc \
      pass(a,b,c,5) \
      key_schedule \
      pass(c,a,b,7) \
      key_schedule \
      pass(b,c,a,9) \
      for(pass_no=3; pass_no<PASSES; pass_no++) { \
        key_schedule \
    pass(a,b,c,9) \
    tmpa=a; a=c; c=b; b=tmpa;} \
      feedforward

#define feedforward
 

Value:

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

#define key_schedule
 

Value:

x[0] -= x[7] ^ U64_FROM_2xU32(0xA5A5A5A5UL, 0xA5A5A5A5UL); \
      x[1] ^= x[0]; \
      x[2] += x[1]; \
      x[3] -= x[2] ^ ((~x[1])<<19); \
      x[4] ^= x[3]; \
      x[5] += x[4]; \
      x[6] -= x[5] ^ ((~x[4])>>23); \
      x[7] ^= x[6]; \
      x[0] += x[7]; \
      x[1] -= x[0] ^ ((~x[7])<<19); \
      x[2] ^= x[1]; \
      x[3] += x[2]; \
      x[4] -= x[3] ^ ((~x[2])>>23); \
      x[5] ^= x[4]; \
      x[6] += x[5]; \
      x[7] -= x[6] ^ U64_FROM_2xU32(0x01234567UL,  0x89ABCDEFUL);

#define pass a,
b,
c,
mul   ) 
 

Value:

round(a,b,c,x[0],mul) \
      round(b,c,a,x[1],mul) \
      round(c,a,b,x[2],mul) \
      round(a,b,c,x[3],mul) \
      round(b,c,a,x[4],mul) \
      round(c,a,b,x[5],mul) \
      round(a,b,c,x[6],mul) \
      round(b,c,a,x[7],mul)

#define PASSES   3
 

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

Value:

c ^= x; \
      a -= t1[((c)>>(0*8))&0xFF] ^ t2[((c)>>(2*8))&0xFF] ^ \
       t3[((c)>>(4*8))&0xFF] ^ t4[((c)>>(6*8))&0xFF] ; \
      b += t4[((c)>>(1*8))&0xFF] ^ t3[((c)>>(3*8))&0xFF] ^ \
       t2[((c)>>(5*8))&0xFF] ^ t1[((c)>>(7*8))&0xFF] ; \
      b *= mul;

#define save_abc
 

Value:

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

#define t1   (tiger_sboxes)
 

#define t2   (&tiger_sboxes[256])
 

#define t3   (&tiger_sboxes[256*2])
 

#define t4   (&tiger_sboxes[256*3])
 

#define tiger_compress_macro str,
state   ) 
 

Value:

{ \
  guint64 a, b, c, tmpa; \
  guint64 aa, bb, cc; \
  guint64 x[8]; \
  int pass_no, i; \
\
  a = state[0]; \
  b = state[1]; \
  c = state[2]; \
\
  for (i = 0; i < 8; i++) x[i] = str[i]; \
\
  compress; \
\
  state[0] = a; \
  state[1] = b; \
  state[2] = c; \
}

#define U64_FROM_2xU32 hi,
lo   )     (((guint64) (hi) << 32) | (lo))
 


Function Documentation

void tiger gconstpointer  data,
guint64  length,
gchar  hash[24]
 

void tiger_check void   ) 
 

Runs some test cases to check whether the implementation of the tiger hash algorithm is alright.

void tiger_compress const guint64 *  data,
guint64  state[3]
[inline, static]
 


Generated on Sat Jun 30 17:53:31 2007 for gtk-gnutella by  doxygen 1.3.9.1