aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples/hash_fd.cpp
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-04-04 03:43:52 +0000
committerlloyd <[email protected]>2011-04-04 03:43:52 +0000
commit3b9bfbd07c3723662832caf5b1efe04de28b656d (patch)
treeee2a9324f384efead6e5bb87ac8374e7e8734c90 /doc/examples/hash_fd.cpp
parent04db054f1ae8de572ee9c0cfe227e76f84096bd6 (diff)
Convert most of the documentation to reStructured Text, adding
a makefile to build it with Sphinx (http://sphinx.pocoo.org/). Previously credits.txt listed public domain code sources; instead directly credit the authors in the relevant files and delete that file. Drop the draft FIPS 140 security policy; I can't imagine FIPS 140 validation will ever happen, and if it does, I don't want anything to do with it. Also drop the internals doc, which was so out of date (and incomplete) as to be worthless. Move the tutorials and InSiTo pdfs into old/ for the time being, until anything relevant from them can be filtered out and converted into RST.
Diffstat (limited to 'doc/examples/hash_fd.cpp')
-rw-r--r--doc/examples/hash_fd.cpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/doc/examples/hash_fd.cpp b/doc/examples/hash_fd.cpp
deleted file mode 100644
index 32acdbec3..000000000
--- a/doc/examples/hash_fd.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
-* (C) 2009 Jack Lloyd
-*
-* Distributed under the terms of the Botan license
-*/
-
-/*
-This is just like the normal hash application, but uses the Unix I/O
-system calls instead of C++ iostreams. Previously, this version was
-much faster and smaller, but GCC 3.1's libstdc++ seems to have been
-improved enough that the difference is now fairly minimal.
-
-Nicely enough, doing the change required changing only about 3 lines
-of code.
-*/
-
-#include <iostream>
-#include <botan/botan.h>
-
-#if !defined(BOTAN_HAS_PIPE_UNIXFD_IO)
- #error "You didn't compile the pipe_unixfd module into Botan"
-#endif
-
-#include <fcntl.h>
-#include <unistd.h>
-
-int main(int argc, char* argv[])
- {
- if(argc < 3)
- {
- std::cout << "Usage: " << argv[0] << " digest <filenames>" << std::endl;
- return 1;
- }
-
- Botan::LibraryInitializer init;
-
- try
- {
- Botan::Pipe pipe(new Botan::Hash_Filter(argv[1]),
- new Botan::Hex_Encoder);
-
- int skipped = 0;
- for(int j = 2; argv[j] != 0; j++)
- {
- int file = open(argv[j], O_RDONLY);
- if(file == -1)
- {
- std::cout << "ERROR: could not open " << argv[j] << std::endl;
- skipped++;
- continue;
- }
- pipe.start_msg();
- file >> pipe;
- pipe.end_msg();
- close(file);
- pipe.set_default_msg(j-2-skipped);
- std::cout << pipe << " " << argv[j] << std::endl;
- }
- }
- catch(Botan::Algorithm_Not_Found)
- {
- std::cout << "Don't know about the hash function \"" << argv[1] << "\""
- << std::endl;
- }
- catch(std::exception& e)
- {
- std::cout << "Exception caught: " << e.what() << std::endl;
- }
- return 0;
- }