jedisct1 / libsodium

A modern, portable, easy to use crypto library.

Home Page:https://libsodium.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

64 bytes for the hash in `crypto_box_curve25519xsalsa20poly1305_seed_keypair(..)`?

getify opened this issue · comments

I'm trying to understand this line:

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?

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.