Back to index

glibc  2.9
Functions | Variables
md5test.c File Reference
#include <string.h>
#include "md5.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])

Variables

struct {
const char * input
const char result [16]
tests []

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 29 of file md5test.c.

{
  struct md5_ctx ctx;
  char sum[16];
  int result = 0;
  int cnt;

  for (cnt = 0; cnt < (int) (sizeof (tests) / sizeof (tests[0])); ++cnt)
    {
      int i;

      __md5_init_ctx (&ctx);
      __md5_process_bytes (tests[cnt].input, strlen (tests[cnt].input), &ctx);
      __md5_finish_ctx (&ctx, sum);
      result |= memcmp (tests[cnt].result, sum, 16);

      __md5_init_ctx (&ctx);
      for (i = 0; tests[cnt].input[i] != '\0'; ++i)
       __md5_process_bytes (&tests[cnt].input[i], 1, &ctx);
      __md5_finish_ctx (&ctx, sum);
      result |= memcmp (tests[cnt].result, sum, 16);
    }

  return result;
}

Here is the call graph for this function:


Variable Documentation

struct { ... } tests[] [static]