mirror of https://github.com/aria2/aria2
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Destroyed digest context after getting calculated hash. * src/Piece.cc * src/Piece.hpull/1/head
parent
91127ed864
commit
4354c674ab
|
@ -1,3 +1,9 @@
|
|||
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Destroyed digest context after getting calculated hash.
|
||||
* src/Piece.cc
|
||||
* src/Piece.h
|
||||
|
||||
2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
|
||||
|
||||
Removed BitfieldManFactory class.
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -164,8 +164,10 @@ public:
|
|||
|
||||
bool isHashCalculated() const;
|
||||
|
||||
// Returns hash value in ASCII hexadecimal form.
|
||||
// WARN: This function must be called only once.
|
||||
// Returns hash value in ASCII hexadecimal form, which is calculated
|
||||
// by updateHash(). Please note that this function returns hash
|
||||
// value only once. Second invocation without updateHash() returns
|
||||
// empty string.
|
||||
std::string getHashString();
|
||||
|
||||
void destroyHashContext();
|
||||
|
|
Loading…
Reference in New Issue