summaryrefslogtreecommitdiffstats
path: root/botan/doc/examples/checksum.cpp
diff options
context:
space:
mode:
authorKeith Isdale <keith.isdale@nokia.com>2010-07-26 14:56:53 +1000
committerKeith Isdale <keith.isdale@nokia.com>2010-07-26 14:56:53 +1000
commit9f034793bcfc51c2b7c1dd14db806f7258f9a9eb (patch)
tree63bd0f50ce5b77828ad8205eafd7b9412810499e /botan/doc/examples/checksum.cpp
parent619d92cfef29e653bfdf852e83888e50cfc4348f (diff)
parent65271649dbc90f3af1184ad1b23bdb64c0c07d07 (diff)
Merge branch 'master' of git://git-nokia.trolltech.com.au/qtsoftware/research/qtuitest
Diffstat (limited to 'botan/doc/examples/checksum.cpp')
-rw-r--r--botan/doc/examples/checksum.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/botan/doc/examples/checksum.cpp b/botan/doc/examples/checksum.cpp
new file mode 100644
index 0000000..232be05
--- /dev/null
+++ b/botan/doc/examples/checksum.cpp
@@ -0,0 +1,31 @@
+#include <botan/botan.h>
+#include <botan/filters.h>
+
+#include <iostream>
+
+using namespace Botan;
+
+int main(int argc, char* argv[])
+ {
+ if(argc != 2)
+ {
+ std::cout << "Usage: " << argv[0] << " filename\n";
+ return 1;
+ }
+
+ Botan::LibraryInitializer init;
+
+ Pipe pipe(new Fork(
+ new Chain(new Hash_Filter("CRC24"), new Hex_Encoder),
+ new Chain(new Hash_Filter("CRC32"), new Hex_Encoder),
+ new Chain(new Hash_Filter("Adler32"), new Hex_Encoder)
+ ));
+
+ DataSource_Stream in(argv[1]);
+
+ pipe.process_msg(in);
+
+ std::cout << pipe.read_all_as_string(0) << "\n";
+ std::cout << pipe.read_all_as_string(1) << "\n";
+ std::cout << pipe.read_all_as_string(2) << "\n";
+ }