Browse Source

add macro pushinh/popping to md5.hpp

master
Niklas Rosenstein 3 years ago
parent
commit
4b9e38c42a
Signed by: NiklasRosenstein GPG Key ID: 06D269B33D25F6C6
1 changed files with 30 additions and 9 deletions
  1. + 30
    - 9
      include/NiklasRosenstein/md5.hpp

+ 30
- 9
include/NiklasRosenstein/md5.hpp

@ -117,6 +117,9 @@ namespace niklasrosenstein {
memset(&this->buffer[used], 0, available - 8);
#ifdef _MSC_VER
#pragma push_macro("OUT")
#endif
#define OUT(dst, src) \
(dst)[0] = (unsigned char)(src); \
(dst)[1] = (unsigned char)((src) >> 8); \
@ -137,6 +140,9 @@ namespace niklasrosenstein {
memset(this, 0, sizeof(*this));
#undef OUT
#ifdef _MSC_VER
#pragma pop_macro("OUT")
#endif
}
inline std::string digest() { std::string r(16, 0); digest(&r[0]); return r; }
@ -147,6 +153,19 @@ namespace niklasrosenstein {
private:
void const* body(void const* data, size_t size) {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4458) // declaration of 'X' hides class member
#pragma push_macro("F")
#pragma push_macro("G")
#pragma push_macro("H")
#pragma push_macro("H2")
#pragma push_macro("I")
#pragma push_macro("STEP")
#pragma push_macro("SET")
#pragma push_macro("GET")
#endif
/* The basic MD5 functions.
*
* F and G are optimized compared to their RFC 1321 definitions for
@ -193,19 +212,11 @@ namespace niklasrosenstein {
(this->block[(n)])
#endif
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4458) // declaration of 'X' hides class member
#endif
unsigned char const* ptr;
uint32_t a, b, c, d;
uint32_t saved_a, saved_b, saved_c, saved_d;
#ifdef _MSC_VER
#pragma warning(pop)
#endif
ptr = reinterpret_cast<unsigned char const*>(data);
a = this->a;
@ -314,7 +325,17 @@ namespace niklasrosenstein {
#undef STEP
#undef SET
#undef GET
#undef OUT
#ifdef _MSC_VER
#pragma warning(pop)
#pragma pop_macro("F")
#pragma pop_macro("G")
#pragma pop_macro("H")
#pragma pop_macro("H2")
#pragma pop_macro("I")
#pragma pop_macro("STEP")
#pragma pop_macro("SET")
#pragma pop_macro("GET")
#endif
}
};

Loading…
Cancel
Save