openMSX
|
This class represents the result of a sha1 calculation (a 160-bit value). More...
#include <sha1.hh>
Classes | |
struct | UninitializedTag |
Public Member Functions | |
Sha1Sum (UninitializedTag) | |
Sha1Sum () | |
Sha1Sum (std::string_view hex) | |
Construct from string, throws when string is malformed. | |
void | parse40 (std::span< const char, 40 > str) |
Parse from a 40-character long buffer. | |
std::string | toString () const |
bool | empty () const |
void | clear () |
constexpr auto | operator<=> (const Sha1Sum &) const =default |
Friends | |
class | SHA1 |
std::ostream & | operator<< (std::ostream &os, const Sha1Sum &sum) |
This class represents the result of a sha1 calculation (a 160-bit value).
Objects of this class can be constructed from/converted to 40-digit hex string. We treat the value '000...00' (all zeros) special. This value can be used to indicate a null-sha1sum value (e.g. sha1 not yet calculated, or not meaningful). In theory it's possible this special value is the result of an actual sha1 calculation, but this has an extremely low probability.
|
inlineexplicit |
openmsx::Sha1Sum::Sha1Sum | ( | ) |
Definition at line 100 of file utils/sha1.cc.
References clear().
|
explicit |
Construct from string, throws when string is malformed.
Definition at line 105 of file utils/sha1.cc.
References parse40().
void openmsx::Sha1Sum::clear | ( | ) |
Definition at line 250 of file utils/sha1.cc.
References ranges::fill().
Referenced by openmsx::SectorAccessibleDisk::flushCaches(), and Sha1Sum().
bool openmsx::Sha1Sum::empty | ( | ) | const |
Definition at line 246 of file utils/sha1.cc.
References ranges::all_of().
Referenced by openmsx::Rom::getOriginalSHA1(), openmsx::Rom::getSHA1(), openmsx::CassetteImage::getSha1Sum(), openmsx::SectorAccessibleDisk::getSha1Sum(), openmsx::CassettePlayer::serialize(), openmsx::HD::serialize(), and openmsx::CassetteImage::setSha1Sum().
|
constexprdefault |
void openmsx::Sha1Sum::parse40 | ( | std::span< const char, 40 > | str | ) |
Parse from a 40-character long buffer.
MSXException | if chars are not 0-9, a-f, A-F |
Definition at line 143 of file utils/sha1.cc.
Referenced by Sha1Sum(), and TEST_CASE().
std::string openmsx::Sha1Sum::toString | ( | ) | const |
Definition at line 234 of file utils/sha1.cc.
Referenced by openmsx::SoftwareInfoTopic::execute(), openmsx::FilePoolCore::getFile(), openmsx::MSXRom::getInfo(), openmsx::CassettePlayer::serialize(), openmsx::HD::serialize(), TEST_CASE(), and TEST_CASE().
|
friend |