summaryrefslogtreecommitdiff
path: root/src/tests/sha1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/sha1.cpp')
-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