K092 / Encoding and decoding
Quoted-Printable
A MIME transfer encoding that keeps predominantly ASCII data human-readable.
CRYPTOGRAPHY LAB / K092
Cryptography Lab · Quoted-Printable
Run real computations and inspect intermediate states step by step.
Educational only. Never enter real passwords or secret keys. Computation stays in your browser; input and trace values are not sent to a server. Do not use this implementation in production.
Quoted-Printable (octet demo)
See the scope above for fixed examples, reduced parameters and supported variants. Standard operation names and formulas are retained.Output
Previous state
- Definition and overview
- A MIME transfer encoding that keeps predominantly ASCII data human-readable. Source document ↗
- Classification and reversibility
- Reversible MIME transfer encoding decoded by the receiver. Source document ↗
- Key or secret requirements
- Not confirmed in the survey
- Operating principle and structure
- Represent nonprinting/special octets as =XX and leave permitted ASCII unchanged. Source document ↗
- Key size, block size and parameters
- 76 characters per line, excluding CRLF but including equals signs. Source document ↗
- Security strength and recommendation
- Not confirmed in the survey
- Known attacks and vulnerabilities
- Some QP decoders have had heap out-of-bounds read vulnerabilities. Source document ↗
- Standards and certification
- RFC 2045 section 6.7 MIME standard. Source document ↗
- Typical uses
- Raw email Content-Transfer-Encoding header. Source document ↗
- Implementations, libraries and tools
- Python quopri and other MIME QP encoders/decoders. Source document ↗
- Decryption or decoding
- Decode =XX and soft line breaks to recover original bytes. Source document ↗
- Advantages
- Efficient for mostly ASCII text with few special characters. Source document ↗
- Limitations and cautions
- Space-inefficient for binary; Base64 is recommended. Source document ↗
- Distinguishing encryption, encoding and hashing
- Transfer encoding only, not encryption or hashing, and provides no confidentiality. Source document ↗
Practical examples
Example
Most ASCII characters remain unchanged; special characters and end-of-line spaces become =XX. The receiver interprets =XX and soft line breaks to restore bytes.
Procedure
Keep permitted bytes, encode required octets as =XX, preserve trailing spaces/tabs as =20/=09 and insert soft breaks within the 76-character limit. Decode =XX and remove soft breaks. No key is involved.
Scenario
Use QP as Content-Transfer-Encoding for mostly ASCII email bodies with occasional special characters; decode for display. Binary attachments typically use Base64.
Pitfalls and alternatives
Prefer Base64 for binary or predominantly non-ASCII text. Watch trailing whitespace, equals signs, lowercase hex, missing soft breaks and decoder bounds checks. Not confidentiality or integrity protection.
References
- MIME & Transfer Encodings (RFC 2045/2046) · emailmarketing.net ↗
- RFC 2049: Multipurpose Internet Mail Extensions (MIME) Part Five: Conformance Criteria and Examples | RFC Editor ↗
- MIME (Multipurpose Internet Mail Extensions): ↗
- OSV - Open Source Vulnerabilities ↗
- Quoted-Printable Encode/Decode - W3Schools ↗
- quopri — Encode and decode MIME quoted-printable data — Python 3.15.2 documentation ↗
- Lib/email/quoprimime.py ↗