32 {
static std::string
_type(
"sha" );
return _type; }
51 , _checksum( checksum )
53 switch ( checksum.size() )
128 WAR <<
"Can't determine type of " << checksum.size() <<
" byte checksum '" <<
_checksum <<
"'" << endl;
136 std::string msg =
str::form (
_(
"Dubious type '%s' for %u byte checksum '%s'"),
156 if ( input_r.good() && ! type_r.empty() )
160 if ( ! input_r.eof() ||
_checksum.empty() )
178 std::ostringstream str;
187 return str << std::string(
"NoCheckSum");
190 return str << ( obj.
type().empty() ? std::string(
"UNKNOWN") : obj.
type() ) <<
'-' << obj.
checksum();
195 const std::string & type( obj.
type() );
198 if ( ! type.empty() ) str <<
" type=\"" << type <<
"\"";
202 str <<
">" <<
checksum <<
"</checksum>";
212 {
return ! ( lhs == rhs ); }
static const std::string & sha256()
sha256
static const std::string & sha1()
sha1
std::string digest()
get hex string representation of the digest
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
static const std::string & sha224Type()
static const std::string & shaType()
std::string form(const char *format,...) __attribute__((format(printf
Printf style construction of std::string.
std::string asString() const
static const std::string & sha256Type()
static const std::string & sha512Type()
static const std::string & sha512()
sha512
std::ostream & operator<<(std::ostream &str, const Exception &obj)
std::string checksum() const
std::string toLower(const std::string &s)
Return lowercase version of s.
static const std::string & sha384Type()
static const std::string & md5()
md5
static const std::string & sha1Type()
std::string checksum(const Pathname &file, const std::string &algorithm)
Compute a files checksum.
static const std::string & sha224()
sha224
bool operator!=(const CheckSum &lhs, const CheckSum &rhs)
CheckSum()
Default Ctor: empty checksum.
bool operator==(const CheckSum &lhs, const CheckSum &rhs)
static const std::string & md5Type()
std::ostream & dumpAsXmlOn(std::ostream &str, const Tp &obj, const std::string &name_r)
static const std::string & sha384()
sha384