Version 6.0
Quasor is a high-security Authenticated Encryption with Associated Data (AEAD) scheme designed for modern applications where robustness and defense-in-depth are paramount. It is built on a Duplex Sponge construction using SHAKE256 and incorporates several advanced features to provide strong protection against both implementation errors and sophisticated attacks.
The primary design goals achieved in this version are:
The master key K
for the cipher is derived from a user-provided password and a unique salt using Argon2id.
password
(variable length) and a unique salt
(minimum 8 bytes).Argon2id
function is called with its default secure parameters (as of v0.5) to produce a 32-byte (256-bit) master key K
.Inputs:
Quasor
instance containing the master key K
.P
.A
.Procedure:
Nonce Derivation (SIV):
a. A 128-bit nonce N is derived by computing the keyed hash of the associated data and the plaintext using a secure, unambiguous serialization.
b. The exact structure to be hashed is: len(A) | A | len(P) | P, where len() is the length in bytes, encoded as a 64-bit little-endian integer. |
c. For large inputs, the hashing of P is automatically parallelized using Rayon for high performance.
Initialization:
a. A new SHAKE256 sponge instance is initialized.
b. The master key K, the derived nonce N, and the associated data A are absorbed into the sponge.
Encryption, Duplexing, and Rekeying:
a. The plaintext P is processed sequentially in chunks of REKEY_INTERVAL size (1 MiB).
b. For each block within a chunk, a keystream is squeezed from the sponge and XORed with the plaintext to produce ciphertext. The original plaintext block is then absorbed back into the sponge’s state.
c. After each 1 MiB chunk is processed (except the last), a rekeying step is performed: 32 bytes are squeezed from the sponge to form an ephemeral key, which is then immediately absorbed back into the state. This provides forward secrecy.
Tag Generation:
a. After all plaintext has been processed, a 32-byte authentication tag T is squeezed from the sponge’s final state.
Outputs:
C
T
N
(must be stored with the ciphertext)Inputs:
Quasor
instance containing the master key K
.N
(16 bytes).C
.A
.T
.Procedure:
Initialization & Decryption: The decryption process mirrors the encryption process exactly: the sponge is initialized with K
, N
, and A
, and the ciphertext is processed sequentially to reconstruct the plaintext, with identical rekeying steps performed along the way.
Tag Verification:
a. After all ciphertext is processed, an expected tag T’ is squeezed from the sponge’s final state.
b. The received tag T must be compared to the computed tag T’ using a constant-time equality function. This is a critical step to prevent timing side-channel attacks. If they do not match, the process aborts, and an error is returned.
Nonce Verification:
a. If the tag is valid, the SIV nonce is re-derived using the newly decrypted plaintext P and the same length-prefixed serialization as in encryption.
b. This re-derived nonce N’ is compared to the received nonce N. If they do not match, the process aborts, and an error is returned. This final check ensures the integrity of the entire message.
Output:
P
(on success) or an authentication error.Quasor
struct and its internal states are designed to use the zeroize
crate, which securely overwrites sensitive key material in memory as soon as it goes out of scope, protecting against certain types of memory-scraping attacks.