[Cryptography] Stream Cipher over Unreliable Transport

jamesd at echeque.com jamesd at echeque.com
Fri Jul 3 03:14:32 EDT 2020


On 2020-07-03 07:13, Sid Spry wrote:
> But I am still interested if there ARE any usable stream ciphers
> for my stated purpose.

Sure:

The default encryption provided by libsodium is an infinite (well, it
repeats after 2^256 bits, which may not be infinity to a mathematician,
but is infinity to an engineer or a physicist) stream of pseudo random
bits.  To encrypt, you exclusiveor the stream onto your data, and to
decrypt, the recipient, who has the same shared secret generating the
stream, exclusiveors it again.

The nonce is an offset into that random stream, or rather the high order
part of that offset.

so, you just use the packet number as your nonce.  Obviously you can
never repeat the same packet number with the same shared secret for
different packets, but you don't want to do that anyway.  You want to
repeat exactly the same packet with the same packet number.




More information about the cryptography mailing list