summaryrefslogtreecommitdiff
path: root/src/Piece.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-02-11 08:33:58 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-02-11 08:33:58 +0000
commit4354c674abf0bc6b66b88f5f7d0be21b66fc4cd0 (patch)
treef7dc6e45b06e3db08c80494c694b5f0f476beab0 /src/Piece.cc
parent91127ed864bb6aad0f1f5e12db07d826c660ae5e (diff)
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Destroyed digest context after getting calculated hash. * src/Piece.cc * src/Piece.h
Diffstat (limited to 'src/Piece.cc')
-rw-r--r--src/Piece.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/Piece.cc b/src/Piece.cc
index 4c88dd9a..3c71bd8c 100644
--- a/src/Piece.cc
+++ b/src/Piece.cc
@@ -250,13 +250,14 @@ bool Piece::isHashCalculated() const
return !_mdctx.isNull() && _nextBegin == length;
}
-// TODO should be getHashString()
std::string Piece::getHashString()
{
if(_mdctx.isNull()) {
return A2STR::NIL;
} else {
- return util::toHex(_mdctx->digestFinal());
+ std::string hash = util::toHex(_mdctx->digestFinal());
+ destroyHashContext();
+ return hash;
}
}