[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-e
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-endian |
Date: |
Tue, 16 Apr 2019 09:59:50 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 608b77383e8a79f7e527a66851a5766548660015
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Mon Apr 15 23:03:04 2019 +0300
MD5: some optimisations for little-endian
---
src/microhttpd/md5.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index 867e0d3f..f3b09aea 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -21,6 +21,10 @@
#include "mhd_byteorder.h"
#include "mhd_assert.h"
+#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
+#define PUT_64BIT_LE(cp, value) ((*(uint64_t*)(cp)) = (uint64_t)(value))
+#define PUT_32BIT_LE(cp, value) ((*(uint32_t*)(cp)) = (uint32_t)(value))
+#else
#define PUT_64BIT_LE(cp, value) do { \
(cp)[7] = (uint8_t)((value) >> 56); \
(cp)[6] = (uint8_t)((value) >> 48); \
@@ -36,6 +40,7 @@
(cp)[2] = (uint8_t)((value) >> 16); \
(cp)[1] = (uint8_t)((value) >> 8); \
(cp)[0] = (uint8_t)((value)); } while (0)
+#endif
static uint8_t PADDING[MD5_BLOCK_SIZE] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -135,11 +140,12 @@ static void
MD5Transform (uint32_t state[4],
const uint8_t block[MD5_BLOCK_SIZE])
{
- uint32_t a, b, c, d, in[MD5_BLOCK_SIZE / 4];
+ uint32_t a, b, c, d;
#if _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN
- memcpy(in, block, sizeof(in));
+ const uint32_t *in = (const uint32_t *)block;
#else
+ uint32_t in[MD5_BLOCK_SIZE / 4];
for (a = 0; a < MD5_BLOCK_SIZE / 4; a++)
{
in[a] = (uint32_t)(
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [libmicrohttpd] branch master updated (1917b866 -> 7ce09bd9), gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 01/06: test_md5: added tests for md5 calculations, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 03/06: MD5: fixed declaration, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 02/06: MD5: replaced needless checks with asserts, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 05/06: MD5: some optimisations for little-endian,
gnunet <=
- [GNUnet-SVN] [libmicrohttpd] 06/06: MD5: optimisation and simplification, gnunet, 2019/04/16
- [GNUnet-SVN] [libmicrohttpd] 04/06: MD5: count bytes, not bits MHD do not add bites, no need to count more precise than bytes, gnunet, 2019/04/16