]>
cygwin.com Git - cygwin-apps/setup.git/blob - csu_util/MD5Sum.h
2 * Copyright (c) 2004 Max Bowsher
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Max Bowsher
15 #ifndef SETUP_MD5SUM_H
16 #define SETUP_MD5SUM_H
19 * A C++ wrapper for the libmd5-rfc library, which additionally provides
20 * storage and comparison of MD5 checksums.
22 * An MD5Sum may be given a value in one of two ways:
24 * 2. md5->begin(); md5->append(); md5->finish();
26 * Once it has a value, md5->isSet() will return true,
31 namespace libmd5_rfc
{
38 MD5Sum() : state(Empty
), internalData(0) {};
39 MD5Sum(const MD5Sum
& source
);
40 MD5Sum
& operator= (const MD5Sum
& source
);
43 void set(const unsigned char digest
[16]);
45 void append(const unsigned char* data
, int nbytes
);
48 bool isSet() const { return (state
== Set
); };
49 operator std::string() const;
50 std::string
str() const { return (std::string
)(*this); };
51 bool operator == (const MD5Sum
& other
) const;
52 bool operator != (const MD5Sum
& other
) const { return !(*this == other
); };
55 enum { Empty
, Accumulating
, Set
} state
;
56 unsigned char digest
[16];
57 libmd5_rfc::md5_state_s
* internalData
;
60 #endif /* SETUP_MD5SUM_H */
This page took 0.040832 seconds and 5 git commands to generate.