diff options
| author | ame <[email protected]> | 2024-05-01 23:52:54 -0500 |
|---|---|---|
| committer | ame <[email protected]> | 2024-05-01 23:52:54 -0500 |
| commit | 81b85b557c308ff743b7b83f2b823e508eef54eb (patch) | |
| tree | feb939eadc804dfbdcf148c70fa235c36912476b /src/hash/blake2.c | |
| parent | 22473687abdbf45c86e837d636cde036845e8460 (diff) | |
fix some hash ub
Diffstat (limited to 'src/hash/blake2.c')
| -rw-r--r-- | src/hash/blake2.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/hash/blake2.c b/src/hash/blake2.c index 61c79ca..9507c96 100644 --- a/src/hash/blake2.c +++ b/src/hash/blake2.c @@ -231,7 +231,7 @@ void blake2b_final(struct blake2b_hash* hash, char* out_stream){ blake2b_round(hash, 1);
- for(int i = 0; i != hash->digest_len; i++)sprintf(out_stream, "%s%02x", out_stream, (((uint8_t*)hash->hash)[i]));
+ for(int i = 0; i != hash->digest_len; i++)sprintf(out_stream + i * 2, "%02x", (((uint8_t*)hash->hash)[i]));
memcpy(hash, &old_hash, sizeof * hash);
memcpy(hash->buffer, old, bs_2);
@@ -363,7 +363,7 @@ void blake2s_final(struct blake2s_hash* hash, char* out_stream){ blake2s_round(hash, 1);
- for(int i = 0; i != hash->digest_len; i++)sprintf(out_stream, "%s%02x", out_stream, (((uint8_t*)hash->hash)[i]));
+ for(int i = 0; i != hash->digest_len; i++)sprintf(out_stream + i * 2, "%02x", (((uint8_t*)hash->hash)[i]));
memcpy(hash, &old_hash, sizeof * hash);
memcpy(hash->buffer, old, bs);
|
