IDA C++ SDK 9.2
Loading...
Searching...
No Matches
md5.h
Go to the documentation of this file.
1#ifndef MD5_H
2#define MD5_H
3
5{
8 unsigned char in[64];
9
10 MD5Context() { memset(this, 0, sizeof(*this)); }
11};
12
13idaman THREAD_SAFE void ida_export MD5Init(MD5Context *context);
14idaman THREAD_SAFE void ida_export MD5Update(MD5Context *context, const void *buf, size_t len);
15idaman THREAD_SAFE void ida_export MD5Final(uchar digest[16], MD5Context *context);
16idaman THREAD_SAFE void ida_export MD5Transform(uint32 buf[4], uint32 const in[16]);
17
18//---------------------------------------------------------------------------
19struct md5_t
20{
22
23 md5_t() { clear(); }
24 md5_t(const md5_t &r) { assign(r); }
25
26 const uchar &operator[](size_t i) const { return hash[i]; }
27 uchar &operator[](size_t i) { return hash[i]; }
28
29 void clear() { memset(hash, 0, sizeof(hash)); }
30 void swap(md5_t &other) { std::swap(*this, other); }
31
33 {
34 if ( this != &r )
35 assign(r);
36 return *this;
37 }
38
40 {
41 return memcmp(hash, r.hash, sizeof(hash));
42 }
43 bool empty() const
44 {
45 for ( size_t i=0; i < sizeof(hash); i++ )
46 if ( hash[i] != 0 )
47 return false;
48 return true;
49 }
50
51
52protected:
53 void assign(const md5_t &r) { memmove(hash, r.hash, sizeof(hash)); }
54};
57
59{
62 bool empty() const { return md5.empty(); }
64 {
65 COMPARE_FIELDS(size);
66 COMPARE_FIELDS(md5);
67 return 0;
68 }
69 // there is no implementation for these methods in this directory
70 // (they are used by vault, and the implementation is autogenerated there)
71 void serialize(bytevec_t *out, int version) const;
72 bool deserialize(const uchar **ptr, size_t len, int version);
73};
76
77#endif /* !MD5_H */
Vector of bytes (use for dynamic memory)
Definition pro.h:3773
Reimplementation of vector class from STL.
Definition pro.h:2250
idaman size_t len
Definition kernwin.hpp:1356
__int64 int64
Definition llong.hpp:14
idaman THREAD_SAFE void ida_export MD5Update(MD5Context *context, const void *buf, size_t len)
idaman THREAD_SAFE void ida_export MD5Transform(uint32 buf[4], uint32 const in[16])
DECLARE_TYPE_AS_MOVABLE(md5_t)
qvector< md5_size_t > md5_sizes_t
Definition md5.h:75
qvector< md5_t > md5_vec_t
Definition md5.h:56
idaman THREAD_SAFE void ida_export MD5Final(uchar digest[16], MD5Context *context)
idaman THREAD_SAFE void ida_export MD5Init(MD5Context *context)
unsigned int uint32
unsigned 32 bit value
Definition pro.h:348
unsigned char uchar
unsigned 8 bit value
Definition pro.h:337
Definition md5.h:5
uint32 buf[4]
Definition md5.h:6
uint32 bits[2]
Definition md5.h:7
unsigned char in[64]
Definition md5.h:8
MD5Context()
Definition md5.h:10
Definition md5.h:59
md5_t md5
Definition md5.h:61
bool empty() const
Definition md5.h:62
int64 size
Definition md5.h:60
DECLARE_COMPARISONS(md5_size_t)
Definition md5.h:63
bool deserialize(const uchar **ptr, size_t len, int version)
void serialize(bytevec_t *out, int version) const
Definition md5.h:20
md5_t & operator=(const md5_t &r)
Definition md5.h:32
void clear()
Definition md5.h:29
uchar & operator[](size_t i)
Definition md5.h:27
uchar hash[16]
Definition md5.h:21
DECLARE_COMPARISONS(md5_t)
Definition md5.h:39
bool empty() const
Definition md5.h:43
md5_t(const md5_t &r)
Definition md5.h:24
const uchar & operator[](size_t i) const
Definition md5.h:26
md5_t()
Definition md5.h:23
void swap(md5_t &other)
Definition md5.h:30
void assign(const md5_t &r)
Definition md5.h:53