2009-01-03 22:22:43 +01:00
|
|
|
/*
|
|
|
|
* Classic "Hello, world" demonstration program
|
|
|
|
*
|
2015-01-23 10:45:19 +01:00
|
|
|
* Copyright (C) 2006-2011, ARM Limited, All Rights Reserved
|
2010-07-18 22:36:00 +02:00
|
|
|
*
|
2015-01-23 12:06:27 +01:00
|
|
|
* This file is part of mbed TLS (https://www.polarssl.org)
|
2010-07-18 22:36:00 +02:00
|
|
|
*
|
2009-01-03 22:22:43 +01:00
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
|
|
|
|
2014-04-29 12:39:06 +02:00
|
|
|
#if !defined(POLARSSL_CONFIG_FILE)
|
2013-09-20 13:30:43 +02:00
|
|
|
#include "polarssl/config.h"
|
2014-04-29 12:39:06 +02:00
|
|
|
#else
|
|
|
|
#include POLARSSL_CONFIG_FILE
|
|
|
|
#endif
|
2009-01-03 22:22:43 +01:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2009-01-03 22:51:57 +01:00
|
|
|
#include "polarssl/md5.h"
|
2009-01-03 22:22:43 +01:00
|
|
|
|
2011-05-26 15:16:06 +02:00
|
|
|
#if !defined(POLARSSL_MD5_C)
|
2011-11-18 15:26:47 +01:00
|
|
|
int main( int argc, char *argv[] )
|
2011-05-26 15:16:06 +02:00
|
|
|
{
|
2011-11-18 15:26:47 +01:00
|
|
|
((void) argc);
|
|
|
|
((void) argv);
|
|
|
|
|
2011-05-26 15:16:06 +02:00
|
|
|
printf("POLARSSL_MD5_C not defined.\n");
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
#else
|
2011-11-18 15:26:47 +01:00
|
|
|
int main( int argc, char *argv[] )
|
2009-01-03 22:22:43 +01:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
unsigned char digest[16];
|
|
|
|
char str[] = "Hello, world!";
|
|
|
|
|
2011-11-18 15:26:47 +01:00
|
|
|
((void) argc);
|
|
|
|
((void) argv);
|
|
|
|
|
2009-01-03 22:22:43 +01:00
|
|
|
printf( "\n MD5('%s') = ", str );
|
|
|
|
|
|
|
|
md5( (unsigned char *) str, 13, digest );
|
|
|
|
|
|
|
|
for( i = 0; i < 16; i++ )
|
|
|
|
printf( "%02x", digest[i] );
|
|
|
|
|
|
|
|
printf( "\n\n" );
|
|
|
|
|
2011-11-18 15:26:47 +01:00
|
|
|
#if defined(_WIN32)
|
2009-01-03 22:22:43 +01:00
|
|
|
printf( " Press Enter to exit this program.\n" );
|
|
|
|
fflush( stdout ); getchar();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|
2011-05-26 15:16:06 +02:00
|
|
|
#endif /* POLARSSL_MD5_C */
|