TIGER(3)

NAME
TIGER_Init, TIGER_Update, TIGER_Final, TIGER_End, TIGER_File, TIGER_Data - calculate TIGER message digests

SYNOPSIS
#include <tiger.h>
void
TIGER_Init(TIGER_CTX *context);
void
TIGER_Update(TIGER_CTX *context, const uint8_t *data, u_int len);
void
TIGER_Final(uint8_t digest[20], TIGER_CTX *context);
char *
TIGER_End(TIGER_CTX *context, char *buf);
char *
TIGER_File(char *filename, char *buf);
char *
TIGER_Data(uint8_t *data, size_t len, char *buf);

DESCRIPTION
The TIGER functions calculate TIGER message digest functions, as defined by Ross Anderson and Eli Biham. The algorithm takes a message less than 2^64 bits as input and produces a 192-bit digest suitable for use as a digital signature.

At the time of writing, May 2011, no attacks or pre-imaging have been discovered against the TIGER_Init message digests, whilst the same cannot be said of md5(3) or sha1(3).

The TIGER_Init() function initializes a TIGER_CTX context for use with TIGER_Update(), and TIGER_Final(). The TIGER_Update() function adds data of length len to the TIGER_CTX specified by context. TIGER_Final() is called when all data has been added via TIGER_Update() and stores a message digest in the digest parameter. When a NULL pointer is passed to TIGER_Final() as first argument only the final padding will be applied and the current context can still be used with TIGER_Update().

The core of the TIGER message digest is performed by TIGER_Update(). Most programs should use the interface provided by TIGER_Init(), TIGER_Update(), and TIGER_Final().

The TIGER_End() function is a frontend for TIGER_Final() which converts the digest into an ASCII representation of the 160 bit digest in hexadecimal.

The TIGER_File() function calculates the digest for a file and returns the result via TIGER_End(). If TIGER_File() is unable to open the file a NULL pointer is returned.

The TIGER_Data() function calculates the digest of an arbitrary string and returns the result via TIGER_End().

For each of the TIGER_End(), TIGER_File(), and TIGER_Data() functions the buf parameter should either be a string of at least 41 characters in size or a NULL pointer. In the latter case, space will be dynamically allocated via malloc(3) and should be freed using free(3) when it is no longer needed.

EXAMPLES
The follow code fragment will calculate the digest for the string “The quick brown fox jumps over the lazy dog”, which is “6d12a41e72e644f017b6f0e2f7b44c6285f06dd5d2c5b075”.

    TIGER_CTX tiger;
    uint8_t results[24];
    char *buf;
    int n;
    buf = "The quick brown fox jumps over the lazy dog";
    n = strlen(buf);
    TIGER_Init(tiger);
    TIGER_Update(tiger, (uint8_t *)buf, n);
    TIGER_Final(results, tiger);
    /* Print the digest as one long hex value */
    printf("0x");
    for (n = 0; n  24; n++)
    	printf("%02x", results[n]);
    putchar('\n');

Alternately, the helper functions could be used in the following way:

    TIGER_CTX tiger;
    uint8_t output[49];
    char *buf = "The quick brown fox jumps over the lazy dog";
    printf("0x%s", TIGER_Data(buf, strlen(buf), output));

SEE ALSO
md5(3), sha1(3) Ross Anderson, Eli Biham, Tiger - A Fast New Hash Function, Proceedings of Fast Software Encryption 3, Cambridge, 1996.

HISTORY
The TIGER functions appeared in NetBSD 6.0.

AUTHORS
-nosplit This implementation of TIGER was adapted by Alistair Crooks <agc@NetBSD.org> from the original reference code.

The TIGER_End(), TIGER_File(), and TIGER_Data() helper functions are derived from code written by Poul-Henning Kamp.

BUGS
All attempts have been made to optimise for the underlying hardware, as well as to format the digest properly in an endian-neutral manner. The author has no VAX hardware on which to test, and so it is not known whether that platform is supported.