{
  "id": "perfect-secrecy",
  "title": "Perfect Secrecy",
  "lang": "en",
  "source_lang": "en",
  "summary": "Perfect secrecy is an encryption property under which observing a ciphertext provides no information about its plaintext, regardless of an adversary’s computational power.",
  "category": "computer-science",
  "subcategory": "networks-security",
  "type": "concept",
  "aliases": [
    "Shannon secrecy",
    "Perfect confidentiality"
  ],
  "generated_at": "2026-11-04",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/perfect-secrecy/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/perfect-secrecy/",
      "json": "https://aiwiki.page/zh/perfect-secrecy.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Perfect secrecy is a property of encryption in which observing a ciphertext does not change the probability of any possible plaintext. An adversary may know the encryption method, the distribution of messages, and the ciphertext, yet learn nothing additional about which message was encrypted. Unlike security based on the difficulty of a computational problem, perfect secrecy holds even against an adversary with unlimited computing power. The one-time pad is its standard example."
    },
    {
      "heading": "Mathematical definition",
      "text": "Consider a secret-key encryption system with a plaintext random variable \\(M\\), a secret key \\(K\\), and a ciphertext \\(C\\). The key is generated independently of the plaintext, and encryption produces\n\n\\[C=\\operatorname{Enc}_K(M).\\]\n\nEncryption may also use fresh randomness. Correctness requires that the intended recipient recover the message:\n\n\\[\\operatorname{Dec}_K(C)=M.\\]\n\nFor a specified message distribution, perfect secrecy means that, for every message \\(m\\) and every ciphertext \\(c\\) with \\(\\Pr(C=c)>0\\),\n\n\\[\\Pr(M=m\\mid C=c)=\\Pr(M=m).\\]\n\nThe left-hand side describes the adversary’s belief after observing the ciphertext; the right-hand side describes the belief beforehand. Their equality means that the ciphertext provides no update.\n\nAn encryption scheme is ordinarily called perfectly secret only if this condition holds for every probability distribution over its message space. This qualification prevents an otherwise insecure scheme from qualifying merely because a particular message source never uses the messages that expose its weakness.\n\nPerfect secrecy does not mean that every message becomes equally likely. If one message was much more probable than another before encryption, it remains more probable afterward. Encryption hides new information; it does not erase existing knowledge.\n\nEquivalent formulations\n\nPerfect secrecy can be expressed as statistical independence:\n\n\\[\\Pr(M=m,C=c)=\\Pr(M=m)\\Pr(C=c).\\]\n\nFor a scheme that must protect every message distribution, an equivalent condition is that every pair of messages induces the same ciphertext distribution:\n\n\\[\\Pr(\\operatorname{Enc}_K(m_0)=c) = \\Pr(\\operatorname{Enc}_K(m_1)=c)\\]\n\nfor every \\(m_0,m_1,c\\), with probabilities taken over key generation and any encryption randomness.\n\nIn information theory, the same property is expressed using mutual information:\n\n\\[I(M;C)=0.\\]\n\nEquivalently,\n\n\\[H(M\\mid C)=H(M),\\]\n\nwhere \\(H\\) denotes Shannon entropy. Observing the ciphertext leaves the message’s uncertainty unchanged.\n\nAn operational formulation gives an adversary two candidate messages and a ciphertext encrypting one of them, selected with equal probability. Under perfect secrecy, no decision rule can identify the selected message with probability greater than \\(1/2\\), even with unlimited computation."
    },
    {
      "heading": "The one-time pad",
      "text": "For an \\(n\\)-bit message, the binary one-time pad chooses a uniformly random \\(n\\)-bit key independently of the message. Encryption and decryption use bitwise exclusive OR:\n\n\\[C=M\\oplus K, \\qquad M=C\\oplus K.\\]\n\nFor any fixed message \\(m\\) and ciphertext \\(c\\), exactly one key satisfies \\(c=m\\oplus k\\): the key \\(k=m\\oplus c\\). Since every key has probability \\(2^{-n}\\),\n\n\\[\\Pr(C=c\\mid M=m)=2^{-n}.\\]\n\nThe ciphertext distribution therefore does not depend on the message, establishing perfect secrecy.\n\nThis proof relies on specific conditions:\n\n- The key is uniformly random over all \\(n\\)-bit strings.\n- The key is independent of the message.\n- The key remains secret.\n- Each key segment is used only once.\n\nA long sequence that merely appears irregular is not necessarily an appropriate pad. Expanding a short seed with a pseudorandom number generator does not provide a uniformly random key over all strings of the expanded length. Such a construction may provide computational security, but not perfect secrecy for arbitrary messages of that length.\n\nWhy key reuse breaks the guarantee\n\nIf the same pad encrypts two messages,\n\n\\[C_1=M_1\\oplus K, \\qquad C_2=M_2\\oplus K,\\]\n\nthen\n\n\\[C_1\\oplus C_2=M_1\\oplus M_2.\\]\n\nThe adversary learns a relation between the messages. If one message becomes known, the other can be recovered directly.\n\nEach ciphertext considered separately can still be independent of its corresponding message, yet the pair of ciphertexts fails to hide the pair of messages. Perfect secrecy must therefore be assessed against the adversary’s complete observation, not merely against individual ciphertexts in isolation."
    },
    {
      "heading": "Key-size limits",
      "text": "Perfect secrecy has a fundamental cost in secret-key material. In a discrete, correctly decryptable system with independent message and key, perfect secrecy implies\n\n\\[H(K)\\geq H(M).\\]\n\nA short derivation uses correctness, which gives \\(H(M\\mid K,C)=0\\), and perfect secrecy, which gives \\(H(M\\mid C)=H(M)\\). Consequently,\n\n\\[H(M) = I(M;K\\mid C) \\leq H(K\\mid C) \\leq H(K).\\]\n\nThe key must contain at least as much uncertainty as the message.\n\nFor a finite message space \\(\\mathcal{M}\\), a scheme that provides perfect secrecy for every message distribution must, in particular, protect a uniformly distributed message. Thus,\n\n\\[H(K)\\geq \\log_2|\\mathcal{M}|,\\]\n\nand its key space \\(\\mathcal{K}\\) must satisfy\n\n\\[|\\mathcal{K}|\\geq|\\mathcal{M}|.\\]\n\nFor arbitrary \\(n\\)-bit messages, at least \\(n\\) bits of key entropy are required. The one-time pad achieves this bound.\n\nThe entropy and key-space statements are related but distinct. For a particular nonuniform message source, \\(H(M)\\) may be much smaller than the logarithm of the number of possible messages. The inequality \\(H(K)\\geq H(M)\\) is a necessary condition, not a general claim that a key of exactly that entropy always suffices.\n\nThese limits explain the practical difficulty of perfectly secret communication: communicating a large amount of arbitrary new data requires a correspondingly large supply of previously shared secret randomness."
    },
    {
      "heading": "Relationship to other security notions",
      "text": "Computational secrecy\n\nMost deployed encryption systems do not offer perfect secrecy. Instead, they aim to make information recovery or message distinguishing infeasible for adversaries with bounded resources.\n\nFor example, the Advanced Encryption Standard uses a fixed-size key while practical modes of operation can process much more data than the key’s length. Their security cannot be perfect secrecy for arbitrary such messages; it depends on computational assumptions, usage limits, and correct implementation.\n\nThe distinction concerns the kind of guarantee:\n\n- Perfect secrecy: ciphertext distributions are exactly identical for every message.\n- Statistical secrecy: the distributions may differ, but only by a small quantified amount, even against an unbounded adversary.\n- Computational secrecy: the distributions need only be indistinguishable to adversaries with bounded computational resources.\n\nThe term information-theoretic security encompasses guarantees that do not rely on computational hardness. Perfect secrecy is an exact confidentiality property within that broader category; not every information-theoretic guarantee is perfect secrecy.\n\nPublic-key encryption\n\nOrdinary public-key encryption cannot provide perfect secrecy with exact correctness under its standard assumptions.\n\nAn unbounded adversary knows the public key and the encryption algorithm. It can enumerate encryption randomness to determine which messages could produce a given ciphertext. For a fixed valid public key, ciphertext supports for distinct messages must be disjoint if decryption always returns the correct message. Identical ciphertext distributions for distinct messages are therefore impossible.\n\nPractical public-key encryption instead relies on computational restrictions. Schemes using additional resources or different correctness and security models must be evaluated under those specific assumptions.\n\nPerfect forward secrecy\n\nPerfect secrecy is distinct from forward secrecy, often called perfect forward secrecy. Forward secrecy concerns whether compromise of long-term keys reveals previously established session keys or past communications.\n\nA protocol can provide forward secrecy while relying entirely on computational assumptions. The word “perfect” in that expression does not imply Shannon’s perfect-secrecy condition."
    },
    {
      "heading": "Scope and limitations",
      "text": "Perfect secrecy is a confidentiality guarantee within a specified threat model. It does not automatically provide other security properties.\n\nNo authentication or integrity\n\nThe one-time pad is malleable. An adversary can replace \\(C\\) with \\(C'=C\\oplus\\Delta\\), causing decryption to produce\n\n\\[M'=M\\oplus\\Delta.\\]\n\nThis changes selected message bits without requiring knowledge of the key. Perfect secrecy therefore does not imply authentication or protection against message modification. Separate mechanisms and security definitions are needed for those properties.\n\nLength and metadata\n\nThe usual one-time-pad proof assumes messages of a fixed length. If ciphertext length reveals plaintext length, the complete observation is not independent of a variable-length message.\n\nSecurity definitions often permit length leakage by comparing only equal-length messages. Perfect secrecy then applies within the specified length class, not to all possible lengths collectively.\n\nEncryption also does not necessarily conceal metadata such as communication times, participant identities, packet counts, or network routes. Such observations must be included explicitly if the intended guarantee is to cover them.\n\nAuxiliary information and implementation\n\nPerfect secrecy does not conceal information already available from other sources. Where an adversary has auxiliary information \\(Z\\), an appropriate requirement may be\n\n\\[I(M;C\\mid Z)=0.\\]\n\nThis states that the ciphertext adds nothing beyond what \\(Z\\) already reveals. Its validity depends on how the key, message, and auxiliary information are related. Information exposing the key can invalidate the guarantee.\n\nThe mathematical definition also does not by itself address insecure key storage, endpoint compromise, or a side-channel attack. A perfectly secret encryption construction can be deployed in a system that leaks plaintext through mechanisms outside its encryption model."
    },
    {
      "heading": "Historical development and significance",
      "text": "Claude Shannon gave perfect secrecy its foundational mathematical treatment in his 1949 paper Communication Theory of Secrecy Systems. His analysis connected cryptography with probability and information theory, formalizing the idea that intercepted ciphertext should reveal no information about its underlying message.\n\nThe one-time pad predates Shannon’s published treatment; his contribution established its secrecy within a general mathematical framework and clarified the key resources required.\n\nPerfect secrecy remains a benchmark for evaluating confidentiality. It precisely separates the absence of information from the practical difficulty of extracting information, and establishes why unrestricted confidentiality against computationally unbounded adversaries requires resources that ordinary reusable-key encryption does not provide."
    }
  ],
  "links": [
    "encryption",
    "one-time-pad",
    "random-variable",
    "probability-distribution",
    "information-theory",
    "mutual-information",
    "information-entropy",
    "bit",
    "pseudorandom-number-generator",
    "advanced-encryption-standard",
    "public-key-cryptography",
    "algorithm",
    "authentication",
    "metadata",
    "side-channel-attack",
    "claude-shannon",
    "cryptography"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}