didactic-drunk / sodium.cr

Crystal wrapper for the libsodium crypto API
MIT License
49 stars 13 forks source link

Providing a 24 byte nonce to XChaCha20 raises error #18

Closed KasKatto closed 2 years ago

KasKatto commented 2 years ago

Providing a 24 byte (192 bit) nonce to Sodium::Cipher::XChaCha20.new() raises an error of:

nonce must be 8 bytes, got 24 (ArgumentError)

Unlike chacha20 which uses an 8 byte nonce xchacha20 uses 24 bytes, but the constant inside the class is incorrectly set to 8 bytes. This will also be the case with XSalsa20.

didactic-drunk commented 2 years ago

Fixed in master (soon to be renamed as main).