aboutsummaryrefslogtreecommitdiff
path: root/src/tests/sha1.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2010-04-23 15:14:00 +0000
committerMike Buland <eichlan@xagasoft.com>2010-04-23 15:14:00 +0000
commit801e7de1f85656746d832508baf4583907826420 (patch)
tree6e2639b6904ee8bcef2781420741124948c17f2c /src/tests/sha1.cpp
parentd8a8c482b2f6b09ee8995b9563397a9b9bd135e8 (diff)
downloadlibbu++-801e7de1f85656746d832508baf4583907826420.tar.gz
libbu++-801e7de1f85656746d832508baf4583907826420.tar.bz2
libbu++-801e7de1f85656746d832508baf4583907826420.tar.xz
libbu++-801e7de1f85656746d832508baf4583907826420.zip
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.
Diffstat (limited to '')
-rw-r--r--src/tests/sha1.cpp39
1 files changed, 39 insertions, 0 deletions
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 @@
1/*
2 * Copyright (C) 2007-2010 Xagasoft, All rights reserved.
3 *
4 * This file is part of the libbu++ library and is released under the
5 * terms of the license contained in the file LICENSE.
6 */
7
8#include "bu/sio.h"
9#include "bu/file.h"
10#include "bu/sha1.h"
11
12using namespace Bu;
13
14int main( int argc, char *argv[] )
15{
16 argv++, argc--;
17 for(; *argv; argv++ )
18 {
19 Bu::File fIn( *argv, Bu::File::Read );
20 Bu::Sha1 m;
21
22 char buf[100000];
23 for(;;)
24 {
25 int iRead = fIn.read( buf, 100000 );
26 m.addData( buf, iRead );
27 if( iRead < 100000 )
28 break;
29 }
30
31 Bu::FString sRes = m.getResult();
32 for( Bu::FString::iterator i = sRes.begin(); i; i++ )
33 {
34 sio << Fmt::hex(2,false) << (int)(unsigned char)(*i);
35 }
36 sio << " *" << *argv << sio.nl;
37 }
38}
39