kitsook/ChaCha20

About length of nonce

Closed this issue · 1 comments

I find out some implementations of chacha20 have " XNonceSize = 24".
eg.
const (
// KeySize is the length of ChaCha20 keys, in bytes.
KeySize = 32
// NonceSize is the length of ChaCha20 nonces, in bytes.
NonceSize = 8
// XNonceSize is the length of XChaCha20 nonces, in bytes.
XNonceSize = 24
)
https://godoc.org/github.com/codahale/chacha20

There is not a 12B nonce .
My question is:
what is the XNonce?
And why we have a 12B nonce?

The original ChaCha20 has 64-bit nonce: http://cr.yp.to/chacha.html

The IETF version has 96-bit nonce. You may refer to RFC 7539 section 2.3
https://tools.ietf.org/html/rfc7539#section-2.3