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, Vol.718, pp.83-104, 19 * Springer-Verlag, 1993. 20 * 21 * This library provides routines to hash 22 * - a string, 23 * - a file, 24 * - input from the standard input device, 25 * - a 32-word block, and 26 * - a string of specified length. 27 * 28 * Author: Yuliang Zheng 29 * School of Computing and Information Technology 30 * Monash University 31 * McMahons Road, Frankston 3199, Australia 32 * Email: yzheng@fcit.monash.edu.au 33 * URL: http://pscit-www.fcit.monash.edu.au:/~yuliang/ 34 * Voice: +61 3 9904 4196 35 * Fax : +61 3 9904 4124 36 * 37 * Date: 38 * First release: June 1993 39 * Revised: April 1996 40 * Many thanks to Ross Williams (ross@rocksoft.com) 41 * for his invaluable comments on the previous 42 * version of the code. 43 * 44 * Copyright (C) 1996 by Yuliang Zheng. All rights reserved. 45 * This program may not be sold or used as inducement to sell 46 * a product without the written permission of the author. 47 */ 48 49#if defined(__alpha) || defined(__LP64__) /* aku, Sep 23, 1996 */ 50typedef unsigned int haval_word; /* a HAVAL word = 32 bits */ 51#else 52typedef unsigned long int haval_word; /* a HAVAL word = 32 bits */ 53#endif 54 55typedef struct { 56 haval_word count[2]; /* number of bits in a message */ 57 haval_word fingerprint[8]; /* current state of fingerprint */ 58 haval_word block[32]; /* buffer for a 32-word block */ 59 unsigned char remainder[32*4]; /* unhashed chars (No.<128) */ 60} haval_state; 61 62 63void haval_string _ANSI_ARGS_((char *, unsigned char *)); /* hash a string */ 64int haval_file _ANSI_ARGS_((char *, unsigned char *)); /* hash a file */ 65void haval_stdin _ANSI_ARGS_((void)); /* filter -- hash input from stdin */ 66void haval_start _ANSI_ARGS_((haval_state *)); /* initialization */ 67void haval_hash _ANSI_ARGS_((haval_state *, unsigned char *, 68 unsigned int)); /* updating routine */ 69void haval_end _ANSI_ARGS_((haval_state *, unsigned char *)); /* finalization */ 70void haval_hash_block _ANSI_ARGS_((haval_state *)); /* hash a 32-word block */ 71 72#endif /* HAVAL_H */ 73