From 801e7de1f85656746d832508baf4583907826420 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 23 Apr 2010 15:14:00 +0000 Subject: Minor updates to the List class, unchecked corner cases. The CsvWriter now writes csv. It understands both excel formatting and c-style, which I made up myself (it's just c-style escape sequences). Sha1 is converted to work with the CryptoHash API and it does indeed work. --- src/tests/sha1.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/tests/sha1.cpp (limited to 'src/tests/sha1.cpp') diff --git a/src/tests/sha1.cpp b/src/tests/sha1.cpp new file mode 100644 index 0000000..b1c798a --- /dev/null +++ b/src/tests/sha1.cpp @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2007-2010 Xagasoft, All rights reserved. + * + * This file is part of the libbu++ library and is released under the + * terms of the license contained in the file LICENSE. + */ + +#include "bu/sio.h" +#include "bu/file.h" +#include "bu/sha1.h" + +using namespace Bu; + +int main( int argc, char *argv[] ) +{ + argv++, argc--; + for(; *argv; argv++ ) + { + Bu::File fIn( *argv, Bu::File::Read ); + Bu::Sha1 m; + + char buf[100000]; + for(;;) + { + int iRead = fIn.read( buf, 100000 ); + m.addData( buf, iRead ); + if( iRead < 100000 ) + break; + } + + Bu::FString sRes = m.getResult(); + for( Bu::FString::iterator i = sRes.begin(); i; i++ ) + { + sio << Fmt::hex(2,false) << (int)(unsigned char)(*i); + } + sio << " *" << *argv << sio.nl; + } +} + -- cgit v1.2.3