Poseidon Cipher: Symmetric Encryption
Complete specification and security proofs for Umbra's counter-mode Poseidon cipher construction for encrypting field elements.
Building on the PRF security of Poseidon, we construct a symmetric encryption scheme that operates natively over the BN254 scalar field. This cipher is specifically designed for encrypting field elements in zero-knowledge circuits while maintaining provable semantic security.
Critical: One-Time Key Usage
The Poseidon cipher uses one-time keys. Each encryption key MUST be used exactly once and MUST NEVER be reused for any subsequent encryption. Reusing a key completely breaks the security of the cipher and leaks plaintext information.
Cipher Construction
Basic Primitive
The Poseidon cipher transforms the Poseidon PRF into a stream cipher using a counter-mode construction. For a given one-time key and counter , both elements of (BN254 scalar field), we define the keystream generator:
Encryption Algorithm
Input:
- One-time key: (must be fresh and unique for this encryption)
- Plaintext: A sequence of field elements where and each
Process:
For each plaintext field element at position (where ranges from to ):
-
Compute the keystream element:
-
Compute the ciphertext element via additive blinding (one-time-pad style):
Output:
The ciphertext:
The key must be securely communicated to the recipient through a separate channel (e.g., Diffie-Hellman key exchange, key encapsulation mechanism).
Decryption Algorithm
Input:
- One-time key: (the same key used for encryption)
- Ciphertext: where each is an encrypted field element
Process:
For each ciphertext element at position :
-
Regenerate the keystream element:
-
Recover the plaintext element:
Output:
The decrypted plaintext:
Critical Security Requirement: One-Time Key Usage
Never Reuse Keys
The encryption key MUST be used for exactly one encryption operation. This is not a recommendation - it is a fundamental security requirement.
Why Key Reuse Breaks Security
If the same key is used to encrypt two different plaintexts and , an adversary can compute:
This directly leaks the additive difference of the plaintexts, completely breaking confidentiality. The attacker learns the relationship between the two messages without needing to know the key.
Consequences of Key Reuse
| Scenario | Security Impact |
|---|---|
| Key used once | Full 128-bit security |
| Key used twice | Complete confidentiality loss for both messages |
| Key used times | All messages compromised via differential analysis |
How to Ensure One-Time Usage
The one-time key requirement is satisfied by deriving fresh keys for each encryption using:
- Diffie-Hellman Key Exchange: Derive a unique shared secret per transaction
- Key Derivation Function (KDF): Derive encryption keys from a master secret with unique context
- Ephemeral Key Generation: Generate a fresh random key for each encryption, encrypt it to the recipient's public key
Example: ECDH-based Key Derivation
For each encryption to recipient with public key :
- Generate ephemeral keypair
- Compute shared secret:
- Derive one-time key:
- Encrypt message with
- Transmit
The recipient reconstructs using their private key and the ephemeral public key.
Formal Security Model
Security Definition: IND-CPA Security
A symmetric encryption scheme is IND-CPA (Indistinguishability under Chosen Plaintext Attack) secure if no probabilistic polynomial-time adversary can distinguish between encryptions of two chosen plaintexts.
Experiment: IND-CPA game with adversary and challenge bit
- Setup: Generate fresh one-time key
- Challenge:
- Adversary submits two equal-length plaintexts: and
- Challenger encrypts with the fresh key and returns ciphertext
- Output: Adversary outputs guess from
Definition: The encryption scheme is IND-CPA secure if for all PPT adversaries , the advantage is negligible:
where is the security parameter (128 bits for our instantiation).
Security Proof
Theorem: IND-CPA Security of Poseidon Cipher
Statement: The Poseidon cipher construction is IND-CPA secure under the assumption that Poseidon is a secure PRF and each key is used exactly once.
Proof:
We prove security via a sequence of game hops, showing that no PPT adversary can distinguish the Poseidon cipher from an ideal one-time-pad construction.
Game 0 (Real World): The adversary interacts with the real Poseidon cipher using a fresh one-time key .
Game 1 (PRF Replacement): Replace the PRF with a truly random function for all queries.
Claim: Games 0 and 1 are computationally indistinguishable under the PRF security of Poseidon.
Justification:
Suppose there exists an adversary that distinguishes Game 0 from Game 1 with non-negligible advantage . We construct a PRF distinguisher that breaks the PRF security of Poseidon.
receives oracle access to either or a random function :
-
When requests encryption of plaintext :
- For each position in the plaintext:
- Query oracle on to get
- Compute
- Return to
- For each position in the plaintext:
-
outputs whatever outputs
If the oracle is , then perfectly simulates Game 0. If the oracle is , then perfectly simulates Game 1.
Therefore, the probability difference between the two games is bounded by the PRF advantage of Poseidon. By the PRF security of Poseidon, this advantage is negligible.
Game 1 Analysis (Information-Theoretic Security):
In Game 1, the keystream elements are uniformly random and independent field elements.
For the challenge ciphertext:
Since is uniformly random in and independent of the plaintext, each is uniformly distributed over regardless of which plaintext was encrypted.
Information-Theoretic Argument:
The ciphertext reveals no information about which plaintext was encrypted. For any ciphertext :
This holds because there exists exactly one keystream sequence that maps to , and exactly one keystream sequence that maps to , and both occur with equal probability.
Therefore, in Game 1:
and the adversary's advantage is exactly 0.
Conclusion:
Combining the game hops, the IND-CPA advantage of any adversary against the Poseidon cipher is bounded by the PRF advantage of Poseidon, which is negligible. Therefore, the Poseidon cipher is IND-CPA secure when keys are used exactly once. ∎
Security Properties Summary
Confidentiality
Guarantee: Under the PRF assumption for Poseidon and with strict one-time key usage, the cipher provides semantic security:
- Ciphertexts leak no information about plaintexts
- Computationally indistinguishable from random field elements
- Security level: 128 bits (matching Poseidon PRF security)
Integrity
Important: This cipher provides no integrity protection. An adversary can:
- Flip arbitrary bits in ciphertexts (resulting in predictable plaintext changes)
- Reorder ciphertext blocks
- Replay old ciphertexts
Recommended: For applications requiring integrity, use an authenticated encryption construction (e.g., encrypt-then-MAC with Poseidon-based MAC).
Malleability
The cipher is additively malleable: given ciphertext , an adversary can produce a valid encryption of by computing .
This property can be:
- A vulnerability in applications requiring non-malleability
- A feature in zero-knowledge applications requiring homomorphic properties
Performance Characteristics
Computational Cost
For encrypting field elements:
- Poseidon evaluations: (one per counter value)
- Field additions: (one per plaintext element)
- Constraint cost (in ZK circuits): Dominated by Poseidon constraints
For width-2 Poseidon (one input), typical constraint count is ~150-200 R1CS constraints per hash.
Comparison to Alternatives
| Scheme | Constraints per Element | Native to Field | ZK-Friendly |
|---|---|---|---|
| Poseidon Cipher | ~150-200 | ✓ | ✓ |
| AES-CTR | ~20,000+ | ✗ | ✗ |
| ChaCha20 | ~15,000+ | ✗ | ✗ |
The Poseidon cipher is ~100× more efficient than traditional ciphers in ZK circuits due to its algebraic design.
Practical Usage Guidelines
Key Generation
- Method: Sample uniformly from using a cryptographically secure random number generator
- Uniqueness: Each key must be freshly generated or derived for each encryption
- Derivation: When using key derivation, ensure unique context/salt per encryption
Key Distribution
Since each key is one-time use, the key must be securely communicated alongside or before the ciphertext:
| Method | Description |
|---|---|
| ECDH | Derive shared secret from ephemeral + static keypairs |
| KEM | Use key encapsulation mechanism (e.g., ECIES) |
| Pre-shared | Use pre-established key material with unique derivation |
Error Handling
- Decryption always succeeds: Since there's no authentication, decryption with wrong key produces random-looking plaintext
- Applications must verify semantic correctness: Use application-layer checks (e.g., check that decrypted values are in expected range)
Formal Security Parameters
| Property | Value | Notes |
|---|---|---|
| Key space | All field elements are valid keys | |
| Key usage | Exactly once | Critical requirement - never reuse |
| Message space | Arbitrary-length sequences of field elements | |
| IND-CPA security | 128 bits | Matching Poseidon PRF security |
| Ciphertext expansion | None | Ciphertext same length as plaintext |
| Parallelizability | Full | All counter values can be computed independently |
Conclusion
The Poseidon cipher instantiation provides provably secure symmetric encryption for field elements under the PRF assumption of Poseidon. The critical requirement is that each key must be used exactly once - this is a fundamental security property, not merely a best practice. When this requirement is satisfied, the cipher achieves 128-bit semantic security. Its native field arithmetic makes it ideal for use in zero-knowledge proof systems, offering computational efficiency far exceeding traditional ciphers.
Poseidon as a PRF: Security Proofs
Comprehensive cryptographic security analysis of Poseidon as a Pseudorandom Function, including formal proofs and security parameters.
Rescue Cipher: MPC-Friendly Encryption
Complete specification of Umbra's Rescue cipher implementation over Curve25519 field for encrypting private inputs to Arcium's MPC network.