tigersum/lib/freetiger/C
2014-09-25 19:18:35 +02:00
..
README Import of the freetiger implementation. 2014-09-25 19:06:11 +02:00
tiger.c Use freetiger by default. 2014-09-25 19:18:35 +02:00
tiger.h Use freetiger by default. 2014-09-25 19:18:35 +02:00
tigermain.c Import of the freetiger implementation. 2014-09-25 19:06:11 +02:00
TODO Import of the freetiger implementation. 2014-09-25 19:06:11 +02:00

These are some implementations of tiger made without looking at the original
reference code to ensure the resulting code can be published under a free
license. The paper was looked though to know how did tiger work.

When compiling the following define flags can be added to enable some features:
* USE_BIG_ENDIAN compile for big endian machines
* FORCE_ALIGNMENT force 8-byte alignment of inoput data on little endian code to
  prevent issues caused by unaligned acceses.
  Please bear in mind that currently we expect properly aligned output buffers
  for result output and that t_res type takes care of that.

The code should detect automatically when a x64 processor and when SSE2 is used
from the compiler predefined macros. When using MSVC please read
http://msdn.microsoft.com/en-us/library/7t5yh4fd.aspx to know how to enable
SSE2 support. In other compilers you may needed to set the __SSE2__ and HASX64
macros by hand.
  
The API offered currently is the following:
/** This one is provided as a commodity for people wanting an easy way to
    declare result variables **/
typedef t_word t_res[3];

/** Partial calculation as used by tigerp1 and tigerp2 **/
typedef struct {
    t_res h; // Hash status
    char r[128]; // SALT
    t_word n; // Number of characters of r used
    t_word hs; // Amount of total data hashed
} t_pres;

/** Standard tiger calculation, put your string in str and the string length on
    length and get the result on res **/
void tiger(const char *str, t_word length, t_res res);

/** Similar to tiger but interleaving accesses to both equally sized strings to
    reduce overhead and pipeline stalls you get the result of str1 on res1 and
    the one of str2 on res2 **/
void tiger_2(const char *str1, const char *str2, t_word length, t_res res1,
             t_res res2);

/** This is equivalent to tiger_2 but uses SSE2 for the key schduling making
    it faster **/
void tiger_sse2(const char *str1, const char *str2, t_word length, t_res res1,
                t_res res2);
             
/** This function is optimized for use on TTHs just send the two concatenated
    hashes and you will get back the hash with a prepended 0x01 **/
void tiger_49(const char *str, t_res res);

/** This function is optimized for use on TTHs just send the 1024 sized block
    and you will get back the hash with a prepended 0x00 **/
void tiger_1025(const char *str, t_res res);

/** Interleaved version of tiger_49 you insert two hashes and get back two
    results **/
void tiger_2_49(const char *str1, const char *str2, t_res res1, t_res res2);

/** Interleaved version of tiger_1025 you insert two hashes and get back two
    results **/
void tiger_2_1025(const char *str1, const char *str2, t_res res1, t_res res2);

/** SSE2 version of tiger_49 you insert two hashes and get back two results **/
void tiger_sse2_49(const char *str1, const char *str2, t_res res1, t_res res2);

/** SSE2 version of tiger_1025 you insert two hashes and get back two results
    **/
void tiger_sse2_1025(const char *str1, const char *str2, t_res res1, t_res res2
                     );

/** First stage of partial tiger calculation to improve password security during
    storage **/
void tigerp1(const char *password, t_word length, const char *salt, t_pres *pres
            );

/** Second stage of partial tiger calculation **/
void tigerp2(const t_pres *pres, const char *salt, t_word length, t_res res);