| 1 | /* |
|---|
| 2 | * Classic "Hello, world" demonstration program |
|---|
| 3 | * |
|---|
| 4 | * Copyright (C) 2006-2011, Brainspark B.V. |
|---|
| 5 | * |
|---|
| 6 | * This file is part of PolarSSL (http://www.polarssl.org) |
|---|
| 7 | * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> |
|---|
| 8 | * |
|---|
| 9 | * All rights reserved. |
|---|
| 10 | * |
|---|
| 11 | * 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 | |
|---|
| 32 | #include "polarssl/config.h" |
|---|
| 33 | |
|---|
| 34 | #include "polarssl/md5.h" |
|---|
| 35 | |
|---|
| 36 | #if !defined(POLARSSL_MD5_C) |
|---|
| 37 | int main( int argc, char *argv[] ) |
|---|
| 38 | { |
|---|
| 39 | ((void) argc); |
|---|
| 40 | ((void) argv); |
|---|
| 41 | |
|---|
| 42 | printf("POLARSSL_MD5_C not defined.\n"); |
|---|
| 43 | return( 0 ); |
|---|
| 44 | } |
|---|
| 45 | #else |
|---|
| 46 | int main( int argc, char *argv[] ) |
|---|
| 47 | { |
|---|
| 48 | int i; |
|---|
| 49 | unsigned char digest[16]; |
|---|
| 50 | char str[] = "Hello, world!"; |
|---|
| 51 | |
|---|
| 52 | ((void) argc); |
|---|
| 53 | ((void) argv); |
|---|
| 54 | |
|---|
| 55 | 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 | |
|---|
| 64 | #if defined(_WIN32) |
|---|
| 65 | printf( " Press Enter to exit this program.\n" ); |
|---|
| 66 | fflush( stdout ); getchar(); |
|---|
| 67 | #endif |
|---|
| 68 | |
|---|
| 69 | return( 0 ); |
|---|
| 70 | } |
|---|
| 71 | #endif /* POLARSSL_MD5_C */ |
|---|