2009-01-03 21:22:43 +00:00
|
|
|
/*
|
|
|
|
* Classic "Hello, world" demonstration program
|
|
|
|
*
|
2011-11-18 14:26:47 +00:00
|
|
|
* Copyright (C) 2006-2011, Brainspark B.V.
|
2010-07-18 20:36:00 +00:00
|
|
|
*
|
|
|
|
* This file is part of PolarSSL (http://www.polarssl.org)
|
2010-07-18 10:13:04 +00:00
|
|
|
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
2010-07-18 20:36:00 +00:00
|
|
|
*
|
2009-07-28 17:23:11 +00:00
|
|
|
* All rights reserved.
|
2009-01-04 16:27:10 +00:00
|
|
|
*
|
2009-01-03 21:22:43 +00: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.
|
|
|
|
*/
|
|
|
|
|
2013-09-20 11:30:43 +00:00
|
|
|
#include "polarssl/config.h"
|
2009-01-03 21:22:43 +00:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2009-01-03 21:51:57 +00:00
|
|
|
#include "polarssl/md5.h"
|
2009-01-03 21:22:43 +00:00
|
|
|
|
2011-05-26 13:16:06 +00:00
|
|
|
#if !defined(POLARSSL_MD5_C)
|
2011-11-18 14:26:47 +00:00
|
|
|
int main( int argc, char *argv[] )
|
2011-05-26 13:16:06 +00:00
|
|
|
{
|
2011-11-18 14:26:47 +00:00
|
|
|
((void) argc);
|
|
|
|
((void) argv);
|
|
|
|
|
2011-05-26 13:16:06 +00:00
|
|
|
printf("POLARSSL_MD5_C not defined.\n");
|
|
|
|
return( 0 );
|
|
|
|
}
|
|
|
|
#else
|
2011-11-18 14:26:47 +00:00
|
|
|
int main( int argc, char *argv[] )
|
2009-01-03 21:22:43 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
unsigned char digest[16];
|
|
|
|
char str[] = "Hello, world!";
|
|
|
|
|
2011-11-18 14:26:47 +00:00
|
|
|
((void) argc);
|
|
|
|
((void) argv);
|
|
|
|
|
2009-01-03 21:22:43 +00: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 14:26:47 +00:00
|
|
|
#if defined(_WIN32)
|
2009-01-03 21:22:43 +00:00
|
|
|
printf( " Press Enter to exit this program.\n" );
|
|
|
|
fflush( stdout ); getchar();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return( 0 );
|
|
|
|
}
|
2011-05-26 13:16:06 +00:00
|
|
|
#endif /* POLARSSL_MD5_C */
|