1#ifndef HAVAL_H
2#define HAVAL_H
3
4#include <tcl.h> /* to surely have _ANSI_ARGS_ */
5
6/*
7 *  haval.h:  specifies the interface to the HAVAL (V.1) hashing library.
8 *
9 *      HAVAL is a one-way hashing algorithm with the following
10 *      collision-resistant property:
11 *             It is computationally infeasible to find two or more
12 *             messages that are hashed into the same fingerprint.
13 *
14 *  Reference:
15 *       Y. Zheng, J. Pieprzyk and J. Seberry:
16 *       ``HAVAL --- a one-way hashing algorithm with variable
17 *       length of output'', Advances in Cryptology --- AUSCRYPT'92,
18 *       Lecture Notes in Computer Science, Springer-Verlag, 1993.
19 *
20 *      This library provides routines to hash
21 *        -  a string,
22 *        -  a file,
23 *        -  input from the standard input device,
24 *        -  a 32-word block, and
25 *        -  a string of specified length.
26 *
27 *  Author:     Yuliang Zheng
28 *              Department of Computer Science
29 *              University of Wollongong
30 *              Wollongong, NSW 2522, Australia
31 *              Email: yuliang@cs.uow.edu.au
32 *              Voice: +61 42 21 4331 (office)
33 *
34 *  Date:       June 1993
35 *
36 *      Copyright (C) 1993 by C^3SR. All rights reserved.
37 *      This program may not be sold or used as inducement to
38 *      buy a product without the written permission of C^3SR.
39 */
40
41#ifdef __alpha /* aku, Sep 23, 1996 */
42typedef unsigned int      haval_word; /* a HAVAL word = 32 bits */
43#else
44typedef unsigned long int haval_word; /* a HAVAL word = 32 bits */
45#endif
46
47typedef struct {
48  haval_word    count[2];                /* number of bits in a message */
49  haval_word    fingerprint[8];          /* current state of fingerprint */
50  haval_word    block[32];               /* buffer for a 32-word block */
51  unsigned char remainder[32*4];         /* unhashed chars (No.<128) */
52} haval_state;
53
54void haval_string     _ANSI_ARGS_((char *, unsigned char *));  /* hash a string */
55int  haval_file       _ANSI_ARGS_((char *, unsigned char *));  /* hash a file */
56void haval_stdin      _ANSI_ARGS_((void));                     /* filter -- hash input from stdin */
57void haval_start      _ANSI_ARGS_((haval_state *));            /* initialization */
58void haval_hash       _ANSI_ARGS_((haval_state *, unsigned char *,
59				   unsigned int));              /* updating routine */
60void haval_end        _ANSI_ARGS_((haval_state *, unsigned char *)); /* finalization */
61void haval_hash_block _ANSI_ARGS_((haval_state *));            /* hash a 32-word block */
62
63#endif
64