summaryrefslogtreecommitdiff
path: root/src/tests/md5test.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-02-19 22:46:37 +0000
committerMike Buland <eichlan@xagasoft.com>2009-02-19 22:46:37 +0000
commit76e10d8d10a9743444942fd0ba5d0f58a122f370 (patch)
treef2e65c6e6baad263391dd7dc981a7f8e167bb707 /src/tests/md5test.cpp
parent0a8a63f836fe8fc6f8b21517d8a5b012544f5e89 (diff)
downloadlibbu++-c6b2ad0fe971811f16db305714c1d6b5205590da.tar.gz
libbu++-c6b2ad0fe971811f16db305714c1d6b5205590da.tar.bz2
libbu++-c6b2ad0fe971811f16db305714c1d6b5205590da.tar.xz
libbu++-c6b2ad0fe971811f16db305714c1d6b5205590da.zip
Hey, this code isn't being used by anyone anymore, ever, anywhere, but I madeoriginal
it compile to get some old tests, and I figured I may as well not throw all that away.
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}