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;
79 : base_type(bufferSize)
117 #endif // _SHA1_OSTREAM_HPP_
boost::iostreams::symmetric_filter< SHA1SymmetricFilter > base_type
model of boost::iostreams::SymmetricFilter
void update(const unsigned char *buffer, size_t bufferSize)
update hash with buffer of bytes
std::string hashProjected() const
returns projected final hash value as if close() were called first; hash remains open and update() ma...
ostream filter for calculating a SHA-1 hash of data on the fly
SHA1_ostream(std::ostream &os, int bufferSize=4096)
bool filter(const char *&src_begin, const char *src_end, char *&dest_begin, char *dest_end, bool flush)
model of boost::iostreams::Filter
SHA1Filter(int bufferSize)
void filter(const TContainer &data, const TContainer &filter, TContainer &result, bool circular=false, uint32_t sides=2)
Applies linear convolution (filtering) to a univariate time series.