3 ms·
yer. i've always used N/2 as a rule of thumb and checked if that is a big enough number. i saw this quote from NIST on crypto exchange in regards to AES-GCM. i
by benmmurphy 7y ago
yer. i've always used N/2 as a rule of thumb and checked if that is a big enough number. i saw this quote from NIST on crypto exchange in regards to AES-GCM. i would usually assume 96 bit -> 48 bit would be enough but they have what I think is some pessimistic advice:
https://crypto.stackexchange.com/questions/42982/safety-of-random-nonce-with-aes-gcm https://crypto.stackexchange.com/questions/42982/safety-of-r...
>> AES-GCM takes a 96-bit nonce and NIST says that you can only encrypt 2^32 messages under a single key if using random nonces. This is because if you throw 2^32 balls at 2^96 buckets then you have roughly a 2^-33 chance of getting two in the same bucket and NIST drew the line there. That probability might seem either high or low to you. It's pretty small in absolute terms and, unlike a work factor, an attacker can't spend resources against it, but it's a very long way from the safety margins that we usually use in cryptography.
i notice libsodium uses xchacha20 which has a larger nonce which is 192 bits size. and in there docs they say:
>> Unlike plain ChaCha20, the nonce is 192 bits long, so that generating a random nonce for every message is safe.
Not sure if they are referring to both libsodium ChaCha20 implementations. One of them is obviously very unsafe with only 64 bit nonce, but one is 96 bit the same as AES-GCM.
- blattimwind 7y ago> i would usually assume 96 bit -> 48 bit would be enough but they have what I think is some pessimistic advice: The "You have n Bits, then you need 2^n/2 tries for a birthday attack, so your real 'security level' is n/2 bits" rule captures the expected value of tries to get a collision. That's the 50 % point. You don't want to design your crypto system in a way that results in a 50 % chance of at least one nonce repetition.