blob: d40c6950097df77c712ad80aed0e85867ea5e17d [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/*
2 * Classic "Hello, world" demonstration program
3 *
Paul Bakker84f12b72010-07-18 10:13:04 +00004 * Copyright (C) 2006-2010, Brainspark B.V.
Paul Bakkerb96f1542010-07-18 20:36:00 +00005 *
6 * This file is part of PolarSSL (http://www.polarssl.org)
Paul Bakker84f12b72010-07-18 10:13:04 +00007 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
Paul Bakkerb96f1542010-07-18 20:36:00 +00008 *
Paul Bakker77b385e2009-07-28 17:23:11 +00009 * All rights reserved.
Paul Bakkere0ccd0a2009-01-04 16:27:10 +000010 *
Paul Bakker5121ce52009-01-03 21:22:43 +000011 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 */
25
26#ifndef _CRT_SECURE_NO_DEPRECATE
27#define _CRT_SECURE_NO_DEPRECATE 1
28#endif
29
30#include <stdio.h>
31
Paul Bakker5690efc2011-05-26 13:16:06 +000032#include "polarssl/config.h"
33
Paul Bakker40e46942009-01-03 21:51:57 +000034#include "polarssl/md5.h"
Paul Bakker5121ce52009-01-03 21:22:43 +000035
Paul Bakker5690efc2011-05-26 13:16:06 +000036#if !defined(POLARSSL_MD5_C)
37int main( void )
38{
39 printf("POLARSSL_MD5_C not defined.\n");
40 return( 0 );
41}
42#else
Paul Bakker5121ce52009-01-03 21:22:43 +000043int main( void )
44{
45 int i;
46 unsigned char digest[16];
47 char str[] = "Hello, world!";
48
49 printf( "\n MD5('%s') = ", str );
50
51 md5( (unsigned char *) str, 13, digest );
52
53 for( i = 0; i < 16; i++ )
54 printf( "%02x", digest[i] );
55
56 printf( "\n\n" );
57
58#ifdef WIN32
59 printf( " Press Enter to exit this program.\n" );
60 fflush( stdout ); getchar();
61#endif
62
63 return( 0 );
64}
Paul Bakker5690efc2011-05-26 13:16:06 +000065#endif /* POLARSSL_MD5_C */