K028 / Cipher modes and AEAD
AES-XTS
A tweakable block cipher mode that encrypts storage sectors without changing their size.
CRYPTOGRAPHY LAB / K028
Cryptography Lab · AES-XTS
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.
AES-XTS (full blocks; no ciphertext stealing)
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 tweakable block cipher mode that encrypts storage sectors without changing their size. Source document ↗
- Classification and reversibility
- Symmetric block-cipher mode with Encrypt/Decrypt APIs. Source document ↗
- Key or secret requirements
- Requires two AES keys: K1 encrypts data and K2 generates sector tweaks. Source document ↗
- Operating principle and structure
- XEX structure encrypts sector number with K2 to form tweak T, XORs block masks and applies K1 AES. Source document ↗
- Key size, block size and parameters
- Needs twice the underlying AES key length; AES-256-XTS uses 512 bits (64 bytes). Source document ↗
- Security strength and recommendation
- NIST SP 800-38E approves XTS for storage confidentiality, but not data authentication. Source document ↗
- Known attacks and vulnerabilities
- Not confirmed in the survey
- Standards and certification
- IEEE 1619-2025 is an active standard specifying XTS-AES for block storage. Source document ↗
- Typical uses
- Length-preserving storage encryption: full-disk encryption, swap/memory/file-based encryption. Source document ↗
- Implementations, libraries and tools
- Go implementations compatible with golang.org/x/crypto/xts exist. Source document ↗
- Decryption or decoding
- Decrypt via API with identical keys and sector number/tweak. Source document ↗
- Advantages
- Position-based tweaks make identical plaintext differ across sectors, reducing patterns. Source document ↗
- Limitations and cautions
- No authentication tag; cannot detect tampering by an attacker with write access. Caution outside disk encryption. Source document ↗
- Distinguishing encryption, encoding and hashing
- XTS is keyed symmetric encryption, not encoding or irreversible hashing. Source document ↗
Practical examples
Example
Prepare fixed-size sector and sector number, encrypt with data key and tweak key to obtain a ciphertext sector of equal length. Decrypt with same keys and sector number.
Procedure
Choose data unit and position (sector number), pass keys to XTS encryption API. Decrypt with identical keys and position. Encoding is keyless reversible; XTS needs keys and hashes cannot be decrypted.
Scenario
Suitable for full-disk/volume encryption preserving fixed sector length in place. For communications or file integrity authentication, use AEAD rather than XTS alone.
Pitfalls and alternatives
XTS lacks authentication/integrity; add AEAD or a separate integrity layer if tamper detection is required. Avoid sector/tweak/key-management errors and misuse for general messages; distinguish encoding and hashing.
References
- XTS: How laptops and phones encrypt their whole disk ↗
- README.md ↗
- AES-XTS: Why Disk Encryption Uses This Specific Mode | QNSQY ↗
- AES-XTS Mode (Disk Encryption) | bitanon/cipherlib ↗
- Recommendation for Block Cipher Modes of Operation: The XTS-AES Mode for Confidentiality on Storage Devices ↗
- IEEE SA - IEEE 1619-2025 ↗
- Report on the Block Cipher Modes of Operation in the NIST SP 800-38 Series ↗
- XTS-AES, explained part by part | Vectree ↗
- xts_mode - Rust ↗
- XTS Mode - Crypto++ Wiki ↗