24 #ifndef _SHA1_OSTREAM_HPP_
25 #define _SHA1_OSTREAM_HPP_
29 #include "boost/iostreams/filtering_stream.hpp"
30 #include "boost/iostreams/filter/symmetric.hpp"
45 bool filter(
const char*& src_begin,
const char* src_end,
46 char*& dest_begin,
char* dest_end,
bool flush)
48 const char* dest_begin_orig = dest_begin;
50 for (; src_begin!=src_end && dest_begin!=dest_end; ++src_begin, ++dest_begin)
51 *dest_begin = *src_begin;
53 sha1_.
update(reinterpret_cast<const unsigned char*>(dest_begin_orig),
54 dest_begin - dest_begin_orig);
72 class SHA1Filter :
public boost::iostreams::symmetric_filter<SHA1SymmetricFilter>
76 typedef boost::iostreams::symmetric_filter<SHA1SymmetricFilter>
base_type;
82 std::string
hash() {
return this->filter().hash();}
117 #endif // _SHA1_OSTREAM_HPP_