libzypp: zypp/Digest.h Source File

libzypp 17.25.10

Digest.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
15 #ifndef ZYPP_MEDIA_DIGEST_H
16 #define ZYPP_MEDIA_DIGEST_H
17
18 #include <string>
19 #include <iosfwd>
20 #include <vector>
21
22 #include <zypp/Callback.h>
23 #include <zypp/Pathname.h>
24
25 namespace zypp {
26
27
28 struct DigestReport : public callback::ReportBase
29 {
30 virtual bool askUserToAcceptNoDigest( const zypp::Pathname &file );
31 virtual bool askUserToAccepUnknownDigest( const Pathname &file, const std::string &name );
32 virtual bool askUserToAcceptWrongDigest( const Pathname &file, const std::string &requested, const std::string &found );
33 };
34
35
36
45 class Digest
46 {
47 private:
48 class P;
49 P* _dp;
50
51 // disabled
52 Digest(const Digest& d);
53 // disabled
54 const Digest& operator=(const Digest& d);
55
56 public:
60 static const std::string & md5();
62 static const std::string & sha1();
64 static const std::string & sha224();
66 static const std::string & sha256();
68 static const std::string & sha384();
70 static const std::string & sha512();
72
73 public:
74 Digest();
75 ~Digest();
76
90 bool create(const std::string& name);
91
93 const std::string& name();
94
100 bool update(const char* bytes, size_t len);
101
107 bool update(std::istream& is, size_t bufsize = 4096);
108
116 std::string digest();
117
122 static std::string digestVectorToString ( const std::vector<unsigned char> &vec );
123
131 std::vector<unsigned char> digestVector();
132
138 bool reset();
139
150 static std::string digest(const std::string& name, std::istream& is, size_t bufsize = 4096);
151
153 static std::string digest( const std::string & name, const std::string & input, size_t bufsize = 4096 );
154 };
155
156 } // namespace zypp
157
158 #endif
Callback.h
Pathname.h
zypp::Digest::P
Definition: Digest.cc:66
zypp::Digest
Compute Message Digests (MD5, SHA1 etc)
Definition: Digest.h:46
zypp::Digest::md5
static const std::string & md5()
md5
Definition: Digest.cc:46
zypp::Digest::sha384
static const std::string & sha384()
sha384
Definition: Digest.cc:58
zypp::Digest::digest
std::string digest()
get hex string representation of the digest
Definition: Digest.cc:189
zypp::Digest::~Digest
~Digest()
Definition: Digest.cc:152
zypp::Digest::Digest
Digest()
Definition: Digest.cc:148
zypp::Digest::sha512
static const std::string & sha512()
sha512
Definition: Digest.cc:61
zypp::Digest::sha1
static const std::string & sha1()
sha1
Definition: Digest.cc:49
zypp::Digest::update
bool update(const char *bytes, size_t len)
feed data into digest computation algorithm
Definition: Digest.cc:226
zypp::Digest::digestVector
std::vector< unsigned char > digestVector()
get vector of unsigned char representation of the digest
Definition: Digest.cc:208
zypp::Digest::sha256
static const std::string & sha256()
sha256
Definition: Digest.cc:55
zypp::Digest::sha224
static const std::string & sha224()
sha224
Definition: Digest.cc:52
zypp::Digest::operator=
const Digest & operator=(const Digest &d)
zypp::Digest::Digest
Digest(const Digest &d)
zypp::Digest::reset
bool reset()
reset internal digest state
Definition: Digest.cc:174
zypp::Digest::name
const std::string & name()
get the name of the current digest algorithm
Definition: Digest.cc:169
zypp::Digest::digestVectorToString
static std::string digestVectorToString(const std::vector< unsigned char > &vec)
get hex string representation of the digest vector given as parameter
Definition: Digest.cc:194
zypp::Digest::_dp
P * _dp
Definition: Digest.h:48
zypp::Digest::create
bool create(const std::string &name)
initialize creation of a new message digest
Definition: Digest.cc:157
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:45
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
zypp::DigestReport
Definition: Digest.h:29
zypp::DigestReport::askUserToAcceptNoDigest
virtual bool askUserToAcceptNoDigest(const zypp::Pathname &file)
Definition: Digest.cc:36
zypp::DigestReport::askUserToAcceptWrongDigest
virtual bool askUserToAcceptWrongDigest(const Pathname &file, const std::string &requested, const std::string &found)
Definition: Digest.cc:42
zypp::DigestReport::askUserToAccepUnknownDigest
virtual bool askUserToAccepUnknownDigest(const Pathname &file, const std::string &name)
Definition: Digest.cc:39
zypp::callback::ReportBase
Definition: Callback.h:150