diff options
author | Jay Berkenbilt <ejb@ql.org> | 2008-04-29 14:55:25 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2008-04-29 14:55:25 +0200 |
commit | 9a0b88bf7777c153dc46ace22db74ef24d51583a (patch) | |
tree | f567ac1cf2bf5071a611eb49323a935b6ac938ff /libqpdf/Pl_MD5.cc | |
download | qpdf-9a0b88bf7777c153dc46ace22db74ef24d51583a.tar.zst |
update release date to actual daterelease-qpdf-2.0
git-svn-id: svn+q:///qpdf/trunk@599 71b93d88-0707-0410-a8cf-f5a4172ac649
Diffstat (limited to 'libqpdf/Pl_MD5.cc')
-rw-r--r-- | libqpdf/Pl_MD5.cc | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libqpdf/Pl_MD5.cc b/libqpdf/Pl_MD5.cc new file mode 100644 index 00000000..0a2711b8 --- /dev/null +++ b/libqpdf/Pl_MD5.cc @@ -0,0 +1,43 @@ + +#include <qpdf/Pl_MD5.hh> + +#include <qpdf/QEXC.hh> + +Pl_MD5::Pl_MD5(char const* identifier, Pipeline* next) : + Pipeline(identifier, next), + in_progress(false) +{ +} + +Pl_MD5::~Pl_MD5() +{ +} + +void +Pl_MD5::write(unsigned char* buf, int len) +{ + if (! this->in_progress) + { + this->md5.reset(); + this->in_progress = true; + } + this->md5.encodeDataIncrementally((char*) buf, len); + this->getNext()->write(buf, len); +} + +void +Pl_MD5::finish() +{ + this->getNext()->finish(); + this->in_progress = false; +} + +std::string +Pl_MD5::getHexDigest() +{ + if (this->in_progress) + { + throw QEXC::General("digest requested for in-progress MD5 Pipeline"); + } + return this->md5.unparse(); +} |