Umbra Privacy LogoUmbra Privacy
Security & Cryptography

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 kk and counter ii, both elements of Fp\mathbb{F}_p (BN254 scalar field), we define the keystream generator:

KeyStream(k,i)=Poseidon(k,i)\mathrm{KeyStream}(k, i) = \mathrm{Poseidon}(k, i)

Encryption Algorithm

Input:

  • One-time key: kFpk \in \mathbb{F}_p (must be fresh and unique for this encryption)
  • Plaintext: A sequence of \ell field elements where m=(m0,m1,)\mathbf{m} = (m_0, m_1, \ldots) and each miFpm_i \in \mathbb{F}_p

Process:

For each plaintext field element mim_i at position ii (where ii ranges from 00 to 1\ell - 1):

  1. Compute the keystream element:

    si=Poseidon(k,i)s_i = \mathrm{Poseidon}(k, i)
  2. Compute the ciphertext element via additive blinding (one-time-pad style):

    ci=mi+si(modp)c_i = m_i + s_i \pmod{p}

Output:

The ciphertext: (c0,c1,)(c_0, c_1, \ldots)

The key kk 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: kFpk \in \mathbb{F}_p (the same key used for encryption)
  • Ciphertext: (c0,c1,)(c_0, c_1, \ldots) where each cic_i is an encrypted field element

Process:

For each ciphertext element cic_i at position ii:

  1. Regenerate the keystream element:

    si=Poseidon(k,i)s_i = \mathrm{Poseidon}(k, i)
  2. Recover the plaintext element:

    mi=cisi(modp)m_i = c_i - s_i \pmod{p}

Output:

The decrypted plaintext: (m0,m1,)(m_0, m_1, \ldots)


Critical Security Requirement: One-Time Key Usage

Never Reuse Keys

The encryption key kk 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 kk is used to encrypt two different plaintexts m\mathbf{m} and m\mathbf{m}', an adversary can compute:

cici=(mi+si)(mi+si)=mimic_i - c'_i = (m_i + s_i) - (m'_i + s_i) = m_i - m'_i

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

ScenarioSecurity Impact
Key used onceFull 128-bit security
Key used twiceComplete confidentiality loss for both messages
Key used nn timesAll nn 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:

  1. Diffie-Hellman Key Exchange: Derive a unique shared secret per transaction
  2. Key Derivation Function (KDF): Derive encryption keys from a master secret with unique context
  3. 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 PrecipientP_{\text{recipient}}:

  1. Generate ephemeral keypair (ske,pke)(sk_e, pk_e)
  2. Compute shared secret: shared=skePrecipient\mathrm{shared} = sk_e \cdot P_{\text{recipient}}
  3. Derive one-time key: k=Hash(shared)k = \mathrm{Hash}(\mathrm{shared})
  4. Encrypt message with kk
  5. Transmit (pke,c0,c1,)(pk_e, c_0, c_1, \ldots)

The recipient reconstructs kk 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 A\mathcal{A} and challenge bit bb

  1. Setup: Generate fresh one-time key kFpk \leftarrow \mathbb{F}_p
  2. Challenge:
    • Adversary A\mathcal{A} submits two equal-length plaintexts: m0\mathbf{m}^0 and m1\mathbf{m}^1
    • Challenger encrypts mb\mathbf{m}^b with the fresh key kk and returns ciphertext (c0,c1,)(c_0, c_1, \ldots)
  3. Output: Adversary outputs guess bb' from {0,1}\{0, 1\}

Definition: The encryption scheme is IND-CPA secure if for all PPT adversaries A\mathcal{A}, the advantage is negligible:

Pr[b=1b=0]Pr[b=1b=1]negl(λ)\left| \Pr[b' = 1 | b = 0] - \Pr[b' = 1 | b = 1] \right| \leq \mathrm{negl}(\lambda)

where λ\lambda 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 kk.

Game 1 (PRF Replacement): Replace the PRF Poseidonk(i)\mathrm{Poseidon}_k(i) with a truly random function R(i)R(i) for all queries.

Claim: Games 0 and 1 are computationally indistinguishable under the PRF security of Poseidon.

Justification:

Suppose there exists an adversary A\mathcal{A} that distinguishes Game 0 from Game 1 with non-negligible advantage ϵ\epsilon. We construct a PRF distinguisher D\mathcal{D} that breaks the PRF security of Poseidon.

D\mathcal{D} receives oracle access to either Poseidonk()\mathrm{Poseidon}_k(\cdot) or a random function R()R(\cdot):

  1. When A\mathcal{A} requests encryption of plaintext m=(m0,m1,)\mathbf{m} = (m_0, m_1, \ldots):

    • For each position ii in the plaintext:
      • Query oracle on ii to get sis_i
      • Compute ci=mi+sic_i = m_i + s_i
    • Return (c0,c1,)(c_0, c_1, \ldots) to A\mathcal{A}
  2. D\mathcal{D} outputs whatever A\mathcal{A} outputs

If the oracle is Poseidonk\mathrm{Poseidon}_k, then D\mathcal{D} perfectly simulates Game 0. If the oracle is RR, then D\mathcal{D} 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 si=R(i)s_i = R(i) are uniformly random and independent field elements.

For the challenge ciphertext:

ci=mib+R(i)c_i = m^b_i + R(i)

Since R(i)R(i) is uniformly random in Fp\mathbb{F}_p and independent of the plaintext, each cic_i is uniformly distributed over Fp\mathbb{F}_p regardless of which plaintext mb\mathbf{m}^b was encrypted.

Information-Theoretic Argument:

The ciphertext reveals no information about which plaintext was encrypted. For any ciphertext c\mathbf{c}:

Pr[cm0]=Pr[cm1]\Pr[\mathbf{c} | \mathbf{m}^0] = \Pr[\mathbf{c} | \mathbf{m}^1]

This holds because there exists exactly one keystream sequence that maps m0\mathbf{m}^0 to c\mathbf{c}, and exactly one keystream sequence that maps m1\mathbf{m}^1 to c\mathbf{c}, and both occur with equal probability.

Therefore, in Game 1:

Pr[b=1b=0]=Pr[b=1b=1]=12\Pr[b' = 1 | b = 0] = \Pr[b' = 1 | b = 1] = \frac{1}{2}

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 ci=mi+sic_i = m_i + s_i, an adversary can produce a valid encryption of mi+δm_i + \delta by computing ci=ci+δc'_i = c_i + \delta.

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 \ell field elements:

  • Poseidon evaluations: \ell (one per counter value)
  • Field additions: \ell (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

SchemeConstraints per ElementNative to FieldZK-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 kk uniformly from Fp\mathbb{F}_p 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:

MethodDescription
ECDHDerive shared secret from ephemeral + static keypairs
KEMUse key encapsulation mechanism (e.g., ECIES)
Pre-sharedUse 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

PropertyValueNotes
Key spaceFp2254\mathbb{F}_p \approx 2^{254}All field elements are valid keys
Key usageExactly onceCritical requirement - never reuse
Message space(Fp)(\mathbb{F}_p)^*Arbitrary-length sequences of field elements
IND-CPA security128 bitsMatching Poseidon PRF security
Ciphertext expansionNoneCiphertext same length as plaintext
ParallelizabilityFullAll 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.