--- id: xxtea version: "5.3.3" license: BSD-2-Clause license_treatment: permissive maintenance: active --- # xxtea — xxtea is a simple block cipher License: permissive · Maintenance: active · Downloads: 275.8K/mo ## What it is and what it does xxtea is a compiled Python extension wrapping the XXTEA symmetric block cipher algorithm. It takes a 128-bit (16-byte) key and encrypts or decrypts data in 32-bit word blocks. The package handles byte-to-word conversions automatically and applies a non-standard 4-byte block PKCS#7 padding by default to ensure input data meets XXTEA's requirement of at least 2 words (8 bytes) and a multiple of 4 bytes. This means you can encrypt arbitrary binary data of any length without manual padding. The module exports four module-level functions—encrypt(), decrypt(), encrypt_hex(), and decrypt_hex()—plus an XXTEA class for creating reusable cipher objects that store the key, padding mode, and round count. Rounds default to 6 + 52/n (where n is the number of 32-bit words), but can be overridden. The non-standard padding scheme makes output incompatible with other XXTEA implementations; use padding=False for raw XXTEA if interoperability is required, though this imposes strict data-length constraints. Use it for: - Encrypt sensitive binary data (credentials, tokens, session data) in Python applications where XXTEA compatibility is needed. - Implement legacy system integration where XXTEA is the mandated cipher for cross-platform communication. - Encrypt arbitrary-length byte strings without manual padding logic by relying on the built-in PKCS#7 scheme. - Create reusable cipher objects for batch encryption/decryption of multiple messages with the same key and settings. - Hex-encode encrypted output for storage or transmission in text-based formats (databases, logs, APIs). ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. xxtea is a Python extension that implements the XXTEA block cipher algorithm, providing functions to encrypt and decrypt data with a 128-bit key using a non-standard 4-byte PKCS#7 padding scheme. Yes, if you need XXTEA specifically for legacy compatibility or cross-platform communication. The package is actively maintained, has no known vulnerabilities, supports modern Python versions (3.9–3.15), and offers prebuilt wheels for easy installation. However, be aware that its non-standard padding makes output incompatible with other XXTEA libraries; use only if interoperability with this specific implementation is required. For new projects, consider modern alternatives like cryptography or nacl. ## Install pip install xxtea uv add xxtea poetry add xxtea ## Installing xxtea Before you install: Medium install friction due to compiled C extension wheels; however, prebuilt wheels are available for Python 3.9–3.15 across major platforms (Linux, macOS, Windows) and architectures, reducing build barriers. Active maintenance with recent release. License in practice: BSD-2-Clause is permissive; you may use, modify, and distribute this package freely in proprietary or open-source projects with minimal restrictions, provided you retain the license notice. Quickstart: import os import xxtea key = os.urandom(16) # 16-byte key required data = b"xxtea is good" enc = xxtea.encrypt(data, key) dec = xxtea.decrypt(enc, key) assert data == dec # Or use the XXTEA type for reusable cipher cipher = xxtea.XXTEA(key) enc2 = cipher.encrypt(data) dec2 = cipher.decrypt(enc2) Key must be exactly 16 bytes; data length must be a multiple of 4 bytes and at least 8 bytes when padding=False is used. Verify before relying: - Compatibility with other XXTEA implementations outside this library (non-standard padding may limit interoperability). - Performance characteristics compared to other Python encryption libraries for typical use cases. - Whether the free-threading support (Python 3.13+) has been tested in production multi-threaded scenarios. ## Package facts - License: BSD-2-Clause (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 275.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags xxtea encryption decryption, block cipher python, 128-bit key encryption, xxtea algorithm implementation, symmetric encryption library, binary data encryption, cryptographic cipher, encryption, legacy-cipher, compiled-extension [View on SkillFed](https://skillfed.io/packages/xxtea) · [View on PyPI](https://pypi.org/project/xxtea/)