blob: 2d98b636558f587242835f1c026360ae748e2e52 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/*
2 * Classic "Hello, world" demonstration program
3 *
Paul Bakkerfc8c4362010-03-21 17:37:16 +00004 * Copyright (C) 2006-2010, Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakker77b385e2009-07-28 17:23:11 +00005 * All rights reserved.
Paul Bakkere0ccd0a2009-01-04 16:27:10 +00006 *
Paul Bakker5121ce52009-01-03 21:22:43 +00007 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22#ifndef _CRT_SECURE_NO_DEPRECATE
23#define _CRT_SECURE_NO_DEPRECATE 1
24#endif
25
26#include <stdio.h>
27
Paul Bakker40e46942009-01-03 21:51:57 +000028#include "polarssl/md5.h"
Paul Bakker5121ce52009-01-03 21:22:43 +000029
30int main( void )
31{
32 int i;
33 unsigned char digest[16];
34 char str[] = "Hello, world!";
35
36 printf( "\n MD5('%s') = ", str );
37
38 md5( (unsigned char *) str, 13, digest );
39
40 for( i = 0; i < 16; i++ )
41 printf( "%02x", digest[i] );
42
43 printf( "\n\n" );
44
45#ifdef WIN32
46 printf( " Press Enter to exit this program.\n" );
47 fflush( stdout ); getchar();
48#endif
49
50 return( 0 );
51}