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