Plaintext and ciphertext

Plaintext is data in readable form before encryption or after decryption; ciphertext is the unreadable output an encryption algorithm produces from plaintext under a key.

Plaintext is information in its readable form, whether text, an image, a database record or any other data. Encryption takes plaintext and a key and produces ciphertext; decryption uses the correct key to turn ciphertext back into plaintext. Some writers use cleartext as a synonym, while others reserve it for data that was never meant to be encrypted, such as a password sent “in the clear” by an older protocol.

Under Kerckhoffs’s principle, the algorithm is assumed to be known, so a sound cipher is expected to produce ciphertext that reveals nothing useful about the plaintext without the key, beyond properties such as length. The two terms also organise the attack models of cryptanalysis, which are classified by what the attacker holds: ciphertext alone in a ciphertext-only attack, matching pairs in a known-plaintext attack, and the ability to choose inputs in a chosen-plaintext attack or a chosen-ciphertext attack. Not every transformed output is ciphertext: Base64 encoding uses no key, and a hash is a one-way digest rather than something to decrypt.

Exam relevance: questions in this area tend to use the two terms to classify an attack. Candidates are expected to identify the attack model from what the attacker holds or can choose, and not to treat encoded or hashed output as ciphertext.