LibPkg
md5.h
Go to the documentation of this file.
1 // This file is part of LibPkg.
2 // Copyright © 2004-2005 Graham Shaw.
3 // Distribution and use are subject to the GNU Lesser General Public License,
4 // a copy of which may be found in the file !LibPkg.Copyright.
5 
6 #ifndef LIBPKG_MD5
7 #define LIBPKG_MD5
8 
9 #include <cstddef>
10 #include <string>
11 #include <iosfwd>
12 
13 namespace pkg {
14 
15 using std::string;
16 
24 class md5
25 {
26 public:
28  typedef unsigned long uint32;
29 
31  typedef unsigned long long uint64;
32 private:
34  static const int state_size=4;
35 
37  static const int buffer_size=16;
38 
43  uint32 state[state_size];
44 
50  uint32 buffer[buffer_size];
51 
56  uint64 count;
57 
64  void process_buffer();
65 public:
67  md5();
68 
76  void operator()(const void* data,size_t length);
77 
84  void operator()(std::istream& in);
85 
91  void operator()();
92 
101  uint32 operator[](unsigned int index)
102  { return state[index]; }
103 
110  operator string();
111 };
112 
113 }; /* namespace pkg */
114 
115 #endif
unsigned long uint32
A type to represent an unsigned 32-bit integer.
Definition: md5.h:28
uint32 operator[](unsigned int index)
Read word from message digest.
Definition: md5.h:101
unsigned long long uint64
A type to represent an unsigned 64-bit integer.
Definition: md5.h:31
A class for producing MD5 message digests.
Definition: md5.h:24
md5()
Construct MD5 object.
Definition: md5.cc:121
void operator()()
Flush buffer.
Definition: md5.cc:249

Reference Manual LibPkg Version 0.6.1 (28 Jan 2015)