shafilt.c:


#include <string.h>
#include <stdio.h>

#include "environ.h"
#include "sha.h"

static sha_context acontext;
static sha_digest  adigest;

/* Digests the standard input and prints the result.
 */

main (argc, argv)
  int argc;
  char *argv[];
{
  int len,loop;
  BITS8 buffer[1024];

  if (argc != 1) {
     printf ("Usage:  ... | SHSfilter ...\n");
     return 1;
  }
 
 shaInit   (&acontext, 1);

  while (len = fread (buffer, 1, 1024, stdin))
     shaUpdate (&acontext, buffer, len);
 shaFinal  (&acontext, adigest);

 for (loop=0; loop<SHF_DIGESTSIZE; loop++) printf ("%02lX", adigest[loop]);
 printf ("\n");

return 0;
}


Go to ...


This page is http://www.cc.utah.edu/~nahaj/c/sha/shafilt.c.html
© Copyright 2000 by John Halleck, All Rights Reserved.
This snapshot was last modified on August 23rd, 2000
And the underlying file was last modified on May 30th, 2000