I am implementing the encryption layer for a communication protocol. The bulk encryption method used is either AES-CCM or AES-GCM. Due to implementation details, encryption of packets is usually, but ...
Sometimes I read that nonce have to be a random number but imho it's wrong, nonce just should not repeat itself. You could increase in by 1 every time if you are sure it would never repeat.
ChaCha8 takes a 8 byte nonce (or IV) that should not be the same twice for the same key. Generating this nonce randomly makes me very very nervous for collisions. Is it safe to generate this nonce ...