blob: d4c362fb107cf10e5968c0806398d2459f1a00b9 [file] [log] [blame]
Paul Bakker5121ce52009-01-03 21:22:43 +00001/*
2 * Classic "Hello, world" demonstration program
3 *
Paul Bakkercce9d772011-11-18 14:26:47 +00004 * Copyright (C) 2006-2011, 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)
Paul Bakkercce9d772011-11-18 14:26:47 +000037int main( int argc, char *argv[] )
Paul Bakker5690efc2011-05-26 13:16:06 +000038{
Paul Bakkercce9d772011-11-18 14:26:47 +000039 ((void) argc);
40 ((void) argv);
41
Paul Bakker5690efc2011-05-26 13:16:06 +000042 printf("POLARSSL_MD5_C not defined.\n");
43 return( 0 );
44}
45#else
Paul Bakkercce9d772011-11-18 14:26:47 +000046int main( int argc, char *argv[] )
Paul Bakker5121ce52009-01-03 21:22:43 +000047{
48 int i;
49 unsigned char digest[16];
50 char str[] = "Hello, world!";
51
Paul Bakkercce9d772011-11-18 14:26:47 +000052 ((void) argc);
53 ((void) argv);
54
Paul Bakker5121ce52009-01-03 21:22:43 +000055 printf( "\n MD5('%s') = ", str );
56
57 md5( (unsigned char *) str, 13, digest );
58
59 for( i = 0; i < 16; i++ )
60 printf( "%02x", digest[i] );
61
62 printf( "\n\n" );
63
Paul Bakkercce9d772011-11-18 14:26:47 +000064#if defined(_WIN32)
Paul Bakker5121ce52009-01-03 21:22:43 +000065 printf( " Press Enter to exit this program.\n" );
66 fflush( stdout ); getchar();
67#endif
68
69 return( 0 );
70}
Paul Bakker5690efc2011-05-26 13:16:06 +000071#endif /* POLARSSL_MD5_C */