From 4309066dff46f52690998bbd1f60ec8b1631f142 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 19 Feb 2009 23:44:57 +0000 Subject: We have the new Bu::CryptoHash base class and Bu::Md5 is here and ready to rock. sha1 is still only a shell, I dunno if/when I'm going to implement that one. So far Bu::Md5 is 100% compatible with md5sum in all tests performed so far, in fact the test program's output is compatible with md5sum in every way (and it's so cute and little too!) Oh, minor update for stdstream and the formatter, they can handle more handy types now. --- src/tests/md5.cpp | 27 +++++++++++++++++++++++++++ src/tests/stdstream.cpp | 4 ++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 src/tests/md5.cpp (limited to 'src/tests') diff --git a/src/tests/md5.cpp b/src/tests/md5.cpp new file mode 100644 index 0000000..dea957b --- /dev/null +++ b/src/tests/md5.cpp @@ -0,0 +1,27 @@ +#include "bu/sio.h" +#include "bu/file.h" +#include "bu/md5.h" + +using Bu::sio; + +int main( int argc, char *argv[] ) +{ + argv++, argc--; + for(; *argv; argv++ ) + { + Bu::File fIn( *argv, Bu::File::Read ); + Bu::Md5 m; + + char buf[1000]; + for(;;) + { + int iRead = fIn.read( buf, 1000 ); + m.addData( buf, iRead ); + if( iRead < 1000 ) + break; + } + + sio << m.getResult() << " *" << *argv << sio.nl; + } +} + diff --git a/src/tests/stdstream.cpp b/src/tests/stdstream.cpp index cb22e22..0949a8c 100644 --- a/src/tests/stdstream.cpp +++ b/src/tests/stdstream.cpp @@ -24,8 +24,8 @@ int main() sio << 0.123 << sio.nl; sio << true << " and then " << false << sio.nl; - //for( int j = 2; j <= 36; j++ ) - // sio << "radix(" << j << ") = " << Fmt().radix( j ) << 255 << sio.nl; + for( int j = 2; j <= 36; j++ ) + sio << "radix(" << j << ") = " << Fmt().radix( j ).width( 8 ).align( Fmt::Right ) << 255 << sio.nl; return 0; } -- cgit v1.2.3