diff options
Diffstat (limited to 'runner.c')
-rw-r--r-- | runner.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -22,6 +22,16 @@ #define MSF 8 +#if BYTE_ORDER == LITTLE_ENDIAN +#define BE_BYTE_INDEX(i) (i^3) +#define LE_BYTE_INDEX(i) (i) +#elif BYTE_ORDER == BIG_ENDIAN +#define BE_BYTE_INDEX(i) (i) +#define LE_BYTE_INDEX(i) (i^3) +#else +#error Unknown endianness +#endif + unsigned char tbl[512]; md5_state_t global_md5; @@ -49,13 +59,7 @@ void raw_MD5_64(unsigned char* input, unsigned char* digest) { */ unsigned int i; for (i = 0; i < 16; ++i) { -#if BYTE_ORDER == LITTLE_ENDIAN - memcpy(digest, tbl + ((unsigned char*)(global_md5.abcd))[i] * 2, 2); -#elif BYTE_ORDER == BIG_ENDIAN - memcpy(digest, tbl + ((unsigned char*)(global_md5.abcd))[i^0x3] * 2, 2); -#else -#error Unknown endianness -#endif + memcpy(digest, tbl + ((unsigned char*)(global_md5.abcd))[LE_BYTE_INDEX(i)] * 2, 2); digest += 2; } } |