diff options
| author | ame <[email protected]> | 2024-06-13 00:01:51 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-06-13 00:01:51 -0500 |
| commit | 90a2acc2f0c9d3904e1dea737e45ef6b10f96a22 (patch) | |
| tree | 401f11f59cbf2cee3c7ec1c58906b7c4d8105e4b /src/hash | |
| parent | 237fcfbd61a9895326538a274f025d9ed57a3903 (diff) | |
working on deepcopy ub
Diffstat (limited to 'src/hash')
| -rw-r--r-- | src/hash/md5.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hash/md5.c b/src/hash/md5.c index 2e6ad98..78211cd 100644 --- a/src/hash/md5.c +++ b/src/hash/md5.c @@ -106,6 +106,7 @@ void md5_update(uint8_t* input, size_t len, struct md5_hash* hash){ void md5_final(struct md5_hash* hash, char out_stream[64]){
uint8_t old[bs];
struct md5_hash old_hash;
+
memcpy(&old_hash, hash, sizeof * hash);
memcpy(old, hash->buffer, bs);
@@ -119,7 +120,8 @@ void md5_final(struct md5_hash* hash, char out_stream[64]){ }
uint32_t lhhh = 8*hash->total;
- memcpy(hash->buffer + 56, &lhhh, sizeof(lhhh));
+ memcpy(hash->buffer + 56, &lhhh, 4);
+
md5_round(hash);
sprintf(out_stream,"%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
|
