aboutsummaryrefslogtreecommitdiff
path: root/src/tests/sha1.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/sha1.cpp')
-rw-r--r--src/tests/sha1.cpp44
1 files changed, 0 insertions, 44 deletions
diff --git a/src/tests/sha1.cpp b/src/tests/sha1.cpp
deleted file mode 100644
index df3113c..0000000
--- a/src/tests/sha1.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
1#include "sha1.h"
2#include "sfile.h"
3
4#define BS 1024
5
6int main( int argc, char *argv[] )
7{
8 argc--; argv++;
9
10 if( argc == 0 )
11 {
12 printf("Provide a filename.\n");
13 return 0;
14 }
15
16 char buf[BS];
17
18 Sha1 s;
19 SFile fin( *argv, "rb" );
20 for(;;)
21 {
22 int nRead = fin.read( buf, BS );
23 if( nRead == 0 )
24 break;
25
26 s.update( buf, nRead );
27 if( nRead < BS )
28 break;
29 }
30
31 unsigned char *dig = s.getDigest();
32
33 char val[]={"0123456789ABCDEF"};
34
35 for( int j = 0; j < 20; j++ )
36 {
37 putchar( val[dig[j]>>4] );
38 putchar( val[dig[j]&0x0F] );
39 }
40 putchar('\n');
41
42 delete[] dig;
43}
44