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 | 2999d3412ccf5c7fc1a9e84695c7a2bce69d3e82 (patch) | |
| tree | 401f11f59cbf2cee3c7ec1c58906b7c4d8105e4b /src/hash | |
| parent | 152b605c856112b074dc7b41651424c4170fc067 (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",
|
