Main Page | Modules | Alphabetical List | Data Structures | 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 OPTIMIZE_FOR_64BIT
#define PASSES   3
#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)
#define tiger_compress(str, state)   tiger_compress_macro(((guint64 *) str), ((guint64 *) state))

Functions

 RCSID ("$Id:tiger.c, v 1.10 2005/07/31 18:45:36 graaff Exp $")
void tiger (gconstpointer data, guint64 length, guint64 res[3])
void tiger_init (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:

x0 -= x7 ^ (((guint64) 0xA5A5A5A5UL << 32) | 0xA5A5A5A5UL); \
    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 ^ (((guint64) 0x01234567UL << 32) | 0x89ABCDEFUL);

#define OPTIMIZE_FOR_64BIT
 

#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[((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 str,
state   )     tiger_compress_macro(((guint64 *) str), ((guint64 *) state))
 

#define tiger_compress_macro str,
state   ) 
 

Value:

{ \
    guint64 a, b, c, tmpa; \
    guint64 aa, bb, cc; \
    guint64 x0, x1, x2, x3, x4, x5, x6, x7; \
    int pass_no; \
\
    a = state[0]; \
    b = state[1]; \
    c = state[2]; \
\
    x0 = str[0]; x1 = str[1]; x2 = str[2]; x3 = str[3]; \
    x4 = str[4]; x5 = str[5]; x6 = str[6]; x7 = str[7]; \
\
    compress; \
\
    state[0] = a; \
    state[1] = b; \
    state[2] = c; \
}


Function Documentation

RCSID "$Id:tiger.  c,
v 1.10 2005/07/31 18:45:36 graaff Exp $" 
 

void tiger gconstpointer  data,
guint64  length,
guint64  res[3]
 

void tiger_init void   ) 
 

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


Generated on Sun Feb 12 10:50:08 2006 for Gtk-Gnutella by doxygen 1.3.6