#include #include #include #include #include "debug.h" namespace xstream{ namespace digest{ static const int eof = std::streambuf::traits_type::eof(); stream::stream(size_t sz) :buf(sz),length(0) { LOG("digest::stream"); setp (buf.buf, buf.buf + buf.size); } stream::~stream() { LOG("digest::~stream"); } int stream::sync() { LOG("digest::stream::sync"); calculate_digest(); setp (buf.buf, buf.buf + buf.size); return 1; } int stream::overflow(const int c) { LOG("digest::stream::overflow "<(c); pbump (1); } pbump (1); length+=buf.size; LOG("\tlength = "<=chunk_size ){ LOG("\tchunk"); setp(beg, beg+chunk_size); calculate_digest(); beg+=chunk_size; t-=chunk_size; length+=chunk_size; LOG("\tlength = "<(c); pbump (1); } return 1; } std::streamsize block_stream::xsputn(char *b, std::streamsize n) { LOG("digest::block_stream::xsputn "<0){ LOG("\t"<