Back to index

courier  0.68.2
Functions | Variables
testsuite.c File Reference
#include "config.h"
#include "sha1.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

static void sha1 ()
static void sha256 ()
static void sha512 ()
int main ()

Variables

static char foo [1000001]

Function Documentation

int main ( )

Definition at line 88 of file testsuite.c.

{
       memset(foo, 'a', 1000000);
       sha1();
       sha256();
       sha512();
       exit (0);
       return (0);
}

Here is the call graph for this function:

static void sha1 ( ) [static]

Definition at line 15 of file testsuite.c.

{
SHA1_DIGEST   digest;
unsigned i, n;

static char *testcases[]={"abc",
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", foo};

       for (n=0; n<sizeof(testcases)/sizeof(testcases[0]); n++)
       {
              i=strlen(testcases[n]);
              sha1_digest(testcases[n], i, digest);
              printf( (i < 200 ? "SHA1(%s)=":
                     "SHA1(%-1.20s...)="), testcases[n]);

              for (i=0; i<20; i++)
              {
                     if (i && (i & 3) == 0)      putchar(' ');
                     printf("%02X", digest[i]);
              }
              printf("\n");
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void sha256 ( ) [static]

Definition at line 39 of file testsuite.c.

{
       SHA256_DIGEST digest;
       unsigned i, n;

       static char *testcases[]={"abc",
                              "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
                              foo};

       for (n=0; n<sizeof(testcases)/sizeof(testcases[0]); n++)
       {
              i=strlen(testcases[n]);
              sha256_digest(testcases[n], i, digest);
              printf( (i < 200 ? "SHA256(%s)=":
                      "SHA256(%-1.20s...)="), testcases[n]);

              for (i=0; i<sizeof(digest); i++)
              {
                     if (i && (i & 3) == 0)      putchar(' ');
                     printf("%02X", digest[i]);
              }
              printf("\n");
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

static void sha512 ( ) [static]

Definition at line 64 of file testsuite.c.

{
       SHA512_DIGEST digest;
       unsigned i, n;

       static char *testcases[]={"abc",
                              "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu",
                              foo};

       for (n=0; n<sizeof(testcases)/sizeof(testcases[0]); n++)
       {
              i=strlen(testcases[n]);
              sha512_digest(testcases[n], i, digest);
              printf( (i < 200 ? "SHA512(%s)=":
                      "SHA512(%-1.20s...)="), testcases[n]);

              for (i=0; i<sizeof(digest); i++)
              {
                     if (i && (i & 7) == 0)      putchar(' ');
                     printf("%02X", digest[i]);
              }
              printf("\n");
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

char foo[1000001] [static]

Definition at line 13 of file testsuite.c.