aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-08-03 13:02:41 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-08-03 13:02:41 +0200
commit93af56873184ab9ed9b17590da142eb4a90722d8 (patch)
tree874b683ce7b0d512cd673ab953f3f14aecb70d40 /src/main.c
parent49005573d3f6ee9123e827f71e694434b29251af (diff)
downloadft_ssl-93af56873184ab9ed9b17590da142eb4a90722d8.tar.gz
ft_ssl-93af56873184ab9ed9b17590da142eb4a90722d8.tar.bz2
ft_ssl-93af56873184ab9ed9b17590da142eb4a90722d8.zip
Fixing sha1 by reversing bytes since it was designed for big endian
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 305d627..25b9947 100644
--- a/src/main.c
+++ b/src/main.c
@@ -6,12 +6,17 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/03 20:29:33 by cacharle #+# #+# */
-/* Updated: 2020/08/02 16:47:01 by charles ### ########.fr */
+/* Updated: 2020/08/03 12:39:25 by charles ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_ssl.h"
+
+/* #if __BYTE_ORDER == __BIG_ENDIAN */
+/* #warn "bonjour" */
+/* #endif */
+
static const uint32_t g_md5_state[4] = {
0x67452301,
0xefcdab89,
@@ -39,9 +44,9 @@ static const uint32_t g_sha256_state[8] = {
};
t_compression_entry g_compression_table[] = {
- {"md5", {md5_compression_func, g_md5_state, sizeof(g_md5_state), 64}},
- {"sha1", {sha1_compression_func, g_sha1_state, sizeof(g_sha1_state), 64}},
- {"sha256", {sha256_compression_func, g_sha256_state, sizeof(g_sha256_state), 64}},
+ {"md5", {md5_compression_func, g_md5_state, sizeof(g_md5_state), sizeof(uint32_t), 64, false}},
+ {"sha1", {sha1_compression_func, g_sha1_state, sizeof(g_sha1_state), sizeof(uint32_t), 64, true}},
+ {"sha256", {sha256_compression_func, g_sha256_state, sizeof(g_sha256_state), sizeof(uint32_t), 64, true}},
};
t_message_digest_param *dispatch_command(char *command)