SHS(3BM)

NAME
shs, bigMessageDigest, shsInit, shsUpdate, shsFinal

SYNOPSIS
#include <libcrypt.h>

(unsigned long *)shs(unsigned char *message, int messageLength)

void shsInit (SHS_CTX *context)

void shsUpdate (SHS_CTX *context, unsigned char *buffer, int length)

void shsFinal (SHS_CTX *context)

bigMessageDigest(unsigned char *message, int messageLength, BigInt digest, int type)

DESCRIPTION

For all of these functions $BigInt$ arguments are assumed to be initialized $BigInts$. $bigInit(0)$ should be used for initialization of empty $BigInts$. If more space is needed than is provided the functions themselves take care of the space allocation. $shs$ is an implementation of the NIST proposed Secure Hash Standard. $shs$ returns a pointer to 5 unsigned longs which make up a hash value for the message. W struct SHS_CTX {

    long totalLength;

    unsigned long h[5];

    unsigned long w[80];

} SHS_CTX; The normal way to use $shs$ is to do the following:

SHS_CTX context;

char buffer[BUF_SIZE];

long length;

FILE *fp;

shsInit(&context);

while (length = fread(buffer, 1, BUF_SIZE, fp)

    shsUpdate(&context, buffer, length);

shsFinal(&context);

Using this method allows for digest seeding. There are times when $shsUpdate$ will be called with a password in the buffer, before entering the read loop. After $shsFinal()$ is called, the digest is in context.h[i], with i = 0 to 4. $bigMessageDigest$ calls shs to create a digest for a buffer of characters. The digest is returned in a $BigInt$. Ing $bigMessageDigest$, the type argument can be SHS, MD2, MD4 or MD5. MD* syntax is identical to that for SHS substituting "MD2, MD4 or MD5" for "SHS" in structures and commands.

SEE ALSO
MD5(3BM), bigInit(3BM), bigTest(3BM), bigBits(3BM), bigToBuf(3BM), bufToBig(3BM), fBigPrint(3BM), atobig(3BM)