Closed getify closed 4 months ago
I'm trying to understand this line: https://github.com/jedisct1/libsodium/blob/4cdcefaff250af42663eb202c1daf49ea4d7ad7e/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c#L16
The rest of that function only uses 32 bytes, so I'm wondering what's the significance/reason for declaring the hash to be 64 bytes wide instead of 32 bytes?
hash
Is it because the [sha512(..) function}(https://github.com/jedisct1/libsodium/blob/4cdcefaff250af42663eb202c1daf49ea4d7ad7e/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c#L274) actually needs/uses all 64 bytes for is operation, even though we only end up using the first 32 bytes from it?
sha512(..)
Yes, the output of the sha512 function is 64 bytes, so a 64 byte buffer is needed.
This issue tracker is for tracking bugs. For general questions, please use the discussions section.
I'm trying to understand this line: https://github.com/jedisct1/libsodium/blob/4cdcefaff250af42663eb202c1daf49ea4d7ad7e/src/libsodium/crypto_box/curve25519xsalsa20poly1305/box_curve25519xsalsa20poly1305.c#L16
The rest of that function only uses 32 bytes, so I'm wondering what's the significance/reason for declaring the
hash
to be 64 bytes wide instead of 32 bytes?Is it because the [
sha512(..)
function}(https://github.com/jedisct1/libsodium/blob/4cdcefaff250af42663eb202c1daf49ea4d7ad7e/src/libsodium/crypto_hash/sha512/cp/hash_sha512_cp.c#L274) actually needs/uses all 64 bytes for is operation, even though we only end up using the first 32 bytes from it?