blob: 3c3e2237df78ed369f63510d79c841772cf1f3eb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
class CheckSum
{
public:
/**
* Creates a checksum for algorithm \param type
* \throws if the checksum is invalid and can't be constructed
*/
CheckSum( const std::string & type, const std::string & checksum);
CheckSum( const std::string & type, std::istream & input_r );
CheckSum();
public:
static const std::string & md5Type();
static const std::string & shaType();
static const std::string & sha1Type();
static const std::string & sha256Type();
static CheckSum md5( const std::string & checksum )
{ return CheckSum( md5Type(), checksum); }
static CheckSum sha( const std::string & checksum )
{ return CheckSum( shaType(), checksum); }
static CheckSum sha1( const std::string & checksum )
{ return CheckSum( sha1Type(), checksum); }
static CheckSum sha256( const std::string & checksum )
{ return CheckSum( sha256Type(), checksum); }
static CheckSum md5( std::istream & input_r )
{ return CheckSum( md5Type(), input_r ); }
static CheckSum sha( std::istream & input_r )
{ return CheckSum( sha1Type(), input_r ); }
static CheckSum sha1( std::istream & input_r )
{ return CheckSum( sha1Type(), input_r ); }
static CheckSum sha256( std::istream & input_r )
{ return CheckSum( sha256Type(), input_r ); }
public:
std::string type() const;
std::string checksum() const;
bool empty() const;
private:
std::string _type;
std::string _checksum;
};
|