/* * Copyright Ó 1992 by Xerox Corporation. All rights reserved. * September 30, 1992 * A straightforward implementation of NIST's proposed Secure * Hash Standard (SHS), dated 22 January 1992. * * To use: allocate an SHS_CTX and pass it to SHSInit; * repeatedly call SHSUpdate on successive chunks of the message * then call SHSFinal(hash, ctx). * The hash is in ctx->state, as 4 byte integers * and, properly reorganized for endian-ness, in *hash. * * These definitions follow the model of the MD5 reference * implementation so it should be easy to to convert clients * between the two. However, the two hash functions produce * different-sized hashes so client conversion is slightly harder than * trivial. */ typedef unsigned long UINT4; typedef struct { UINT4 state[5]; /* state (ABCDE) */ UINT4 count[2]; /* number of bits */ unsigned char buffer[64]; /* input buffer */ } SHS_CTX; #define PROTO_LIST(x) (); void SHSInit PROTO_LIST ((SHS_CTX *)); void SHSUpdate PROTO_LIST ((SHS_CTX *, unsigned char *, unsigned int)); /* SHSUpdate( ctx, buffer, bytes ) */ void SHSFinal PROTO_LIST ((unsigned char [20], SHS_CTX *)); /* SHSFinal( hash, ctx ) */