/* */ #include "Checksum.h" #include "MessageDigest.h" namespace aria2 { Checksum::Checksum(std::string hashType, std::string digest) : hashType_(std::move(hashType)), digest_(std::move(digest)) { } Checksum::Checksum() : hashType_("sha-1") {} Checksum::~Checksum() {} bool Checksum::isEmpty() const { return digest_.empty(); } void Checksum::setDigest(std::string digest) { digest_ = std::move(digest); } void Checksum::setHashType(std::string hashType) { hashType_ = std::move(hashType); } void Checksum::swap(Checksum& other) { using std::swap; if (this != &other) { swap(hashType_, other.hashType_); swap(digest_, other.digest_); } } void swap(Checksum& a, Checksum& b) { a.swap(b); } bool HashTypeStronger::operator()(const Checksum& lhs, const Checksum& rhs) const { return MessageDigest::isStronger(lhs.getHashType(), rhs.getHashType()); } } // namespace aria2