diff options
Diffstat (limited to 'src/lib/util/hashing.h')
-rw-r--r-- | src/lib/util/hashing.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/lib/util/hashing.h b/src/lib/util/hashing.h index 8b58d3afc8b..906bad047b4 100644 --- a/src/lib/util/hashing.h +++ b/src/lib/util/hashing.h @@ -33,10 +33,10 @@ struct sha1_t { bool operator==(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) == 0; } bool operator!=(const sha1_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } - operator UINT8 *() { return m_raw; } + operator uint8_t *() { return m_raw; } bool from_string(const char *string, int length = -1); std::string as_string() const; - UINT8 m_raw[20]; + uint8_t m_raw[20]; static const sha1_t null; }; @@ -51,7 +51,7 @@ public: void reset() { sha1_init(&m_context); } // append data - void append(const void *data, UINT32 length) { sha1_update(&m_context, length, reinterpret_cast<const UINT8 *>(data)); } + void append(const void *data, uint32_t length) { sha1_update(&m_context, length, reinterpret_cast<const uint8_t *>(data)); } // finalize and compute the final digest sha1_t finish() @@ -63,7 +63,7 @@ public: } // static wrapper to just get the digest from a block - static sha1_t simple(const void *data, UINT32 length) + static sha1_t simple(const void *data, uint32_t length) { sha1_creator creator; creator.append(data, length); @@ -84,10 +84,10 @@ struct md5_t { bool operator==(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) == 0; } bool operator!=(const md5_t &rhs) const { return memcmp(m_raw, rhs.m_raw, sizeof(m_raw)) != 0; } - operator UINT8 *() { return m_raw; } + operator uint8_t *() { return m_raw; } bool from_string(const char *string, int length = -1); std::string as_string() const; - UINT8 m_raw[16]; + uint8_t m_raw[16]; static const md5_t null; }; @@ -102,7 +102,7 @@ public: void reset() { MD5Init(&m_context); } // append data - void append(const void *data, UINT32 length) { MD5Update(&m_context, reinterpret_cast<const unsigned char *>(data), length); } + void append(const void *data, uint32_t length) { MD5Update(&m_context, reinterpret_cast<const unsigned char *>(data), length); } // finalize and compute the final digest md5_t finish() @@ -113,7 +113,7 @@ public: } // static wrapper to just get the digest from a block - static md5_t simple(const void *data, UINT32 length) + static md5_t simple(const void *data, uint32_t length) { md5_creator creator; creator.append(data, length); @@ -134,11 +134,11 @@ struct crc32_t { bool operator==(const crc32_t &rhs) const { return m_raw == rhs.m_raw; } bool operator!=(const crc32_t &rhs) const { return m_raw != rhs.m_raw; } - crc32_t &operator=(const UINT32 crc) { m_raw = crc; return *this; } - operator UINT32() const { return m_raw; } + crc32_t &operator=(const uint32_t crc) { m_raw = crc; return *this; } + operator uint32_t() const { return m_raw; } bool from_string(const char *string, int length = -1); std::string as_string() const; - UINT32 m_raw; + uint32_t m_raw; static const crc32_t null; }; @@ -153,13 +153,13 @@ public: void reset() { m_accum.m_raw = 0; } // append data - void append(const void *data, UINT32 length); + void append(const void *data, uint32_t length); // finalize and compute the final digest crc32_t finish() { return m_accum; } // static wrapper to just get the digest from a block - static crc32_t simple(const void *data, UINT32 length) + static crc32_t simple(const void *data, uint32_t length) { crc32_creator creator; creator.append(data, length); @@ -180,11 +180,11 @@ struct crc16_t { bool operator==(const crc16_t &rhs) const { return m_raw == rhs.m_raw; } bool operator!=(const crc16_t &rhs) const { return m_raw != rhs.m_raw; } - crc16_t &operator=(const UINT16 crc) { m_raw = crc; return *this; } - operator UINT16() const { return m_raw; } + crc16_t &operator=(const uint16_t crc) { m_raw = crc; return *this; } + operator uint16_t() const { return m_raw; } bool from_string(const char *string, int length = -1); std::string as_string() const; - UINT16 m_raw; + uint16_t m_raw; static const crc16_t null; }; @@ -199,13 +199,13 @@ public: void reset() { m_accum.m_raw = 0xffff; } // append data - void append(const void *data, UINT32 length); + void append(const void *data, uint32_t length); // finalize and compute the final digest crc16_t finish() { return m_accum; } // static wrapper to just get the digest from a block - static crc16_t simple(const void *data, UINT32 length) + static crc16_t simple(const void *data, uint32_t length) { crc16_creator creator; creator.append(data, length); |