Skip to content

Conversation

@Forostovec
Copy link

Reason:
Previously poseidon2 encryption packed (encryption_nonce, L) into a single field element assuming a 128-bit nonce, but this was only documented in a TODO comment and never enforced. Callers could pass arbitrary field elements as nonces, breaking the intended 128-bit nonce invariant and making the encoding less clearly injective from a security/analysis point of view.

Overview of changes:

  • Add an assertion in poseidon2_encrypt to ensure encryption_nonce < 2^128 (TWO_POW_128).
  • Add the same assertion in poseidon2_decrypt to mirror the invariant at decryption time and keep both sides in sync with the documented design.
  • Remove the obsolete TODO that referenced these missing checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant