#include	<windows.h>
#include	<stdio.h>
#include	<conio.h>

#include	"CHashMD5.h"

void main( void)
{

	CHashMD5	h;
	char		hsh[32+1];
	char		txt[] = "ahoj";   // << tento string je "char *"
	int			i;
	int			len;

	// zahasuj string "ahoj"
	h.m_hash( hsh, txt, strlen( txt));  // << metoda m_hash ma hlavicku (char, unsigned char, unsigned long int)

	// vytiskni to
	printf( "%s = \"%s\"\n", txt, hsh);

//*
char *msg[] = 
{
    "",
    "a",
    "abc",
    "message digest",
    "abcdefghijklmnopqrstuvwxyz",
    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
    "12345678901234567890123456789012345678901234567890123456789012345678901234567890"
};

char *val[] =
{
    "d41d8cd98f00b204e9800998ecf8427e",
    "0cc175b9c0f1b6a831c399e269772661",
    "900150983cd24fb0d6963f7d28e17f72",
    "f96b697d7cb7938d525a2f31aaf161d0",
    "c3fcd3d76192e4007dfb496cca67e13b",
    "d174ab98d277d9f5a5611c2c9f419d9f",
    "57edf4a22be3c955ac49da2e2107b67a"
};

    printf( "\n MD5 Validation Tests:\n\n" );

    for( i = 0; i < 7; i++ )
    {
		printf( " Test %d ", i + 1 );

		len = strlen( msg[i]);

		h.m_hash( hsh, msg[i], len);

		if( memcmp( hsh, val[i], 32 ) )
		{
			printf( "failed!\n" );
			return;
		}

		printf( "passed.\n" );
    }
// */
}