summaryrefslogtreecommitdiff
path: root/src/tests/md5test.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/tests/md5test.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/tests/md5test.cpp b/src/tests/md5test.cpp
index 6f832df..2cc8868 100644
--- a/src/tests/md5test.cpp
+++ b/src/tests/md5test.cpp
@@ -2,18 +2,31 @@
2#include <string.h> 2#include <string.h>
3#include "md5.h" 3#include "md5.h"
4 4
5int main() 5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <unistd.h>
8
9
10int main( int argc, char *argv[] )
6{ 11{
7 md5 mproc; 12 md5 mproc;
8 md5sum sum; 13 md5sum sum;
9 char hexstr[33]; 14 char hexstr[33];
10 15
16 struct stat s;
17 stat( argv[1], &s );
18 char *buf = new char[s.st_size];
19 FILE *fh = fopen( argv[1], "rb" );
20 fread( buf, 1, s.st_size, fh );
21 fclose( fh );
22
11 memset( hexstr, 0, 33 ); 23 memset( hexstr, 0, 33 );
12 24
13 mproc.sumString( &sum, "qwertyuiopasdfgh" ); 25 mproc.sumData( &sum, buf, s.st_size );
14 mproc.sumToHex( &sum, hexstr ); 26 mproc.sumToHex( &sum, hexstr );
15 printf("sum: %s\n", hexstr ); 27 printf("sum: %s\n", hexstr );
16 printf("chk: 1ebfc043d8880b758b13ddc8aa1638ef\n"); 28
29 delete[] buf;
17 30
18 return 0; 31 return 0;
19} 32}