Chaotic Logistic Map: Dynamically generates 128-bit sub-keys per 64-bit block using a chaotic logistic map with r = 3.99, ensuring one-time pad-like behavior.
Unbalanced Feistel Network: Operates on variable block sizes (multiples of 32 bits; minimum 64 bits) with round dependency.
Round Count: Uses the adaptive rule rounds = floor(6 + 52 / n) to match block length per the paper.
Round Constant: Employs the magic constant 0x9E3779B9 to avoid symmetry-based attacks.
Substitution Layer: Applies AES S-Box (Table 5 in the paper) for nonlinear diffusion before block processing.
Key Mixing: Incorporates SHA-256 hash of the base key for stronger entropy prior to chaotic key scheduling.
Integrity: Optional HMAC-SHA256 can be appended to each ciphertext for authenticity verification.
Note:For reproducible tests, set a fixed nonce (e.g., 0). For security demonstrations, leave nonce blank to randomize each run.
For production use, enable HMAC Integrity Check to protect against tampering and padding oracle attacks.
When interoperating with other implementations, ensure the same S-Box (Table 5) and the same endian/packing conventions (little-endian 32-bit words) are used.
File Support is optional, not described in the paper. Downloaded encrypted files will be of .enc extension
4. Usage Recommendations and Parameters
4.1 Block and Word Sizes
Parameter
Symbol
Typical Value
Notes
Word size
32 bits
fixed
All operations use 32-bit unsigned words.
Minimum block size
64 bits (2 words)
required
Smallest valid block for the Feistel network.
Typical block size
128 bits (4 words)
recommended
Best balance between speed and diffusion.
Maximum block size
n × 32 bits
arbitrary
Limited only by memory; rounds scale with block length.
Note: Using fewer than four 32-bit words reduces diffusion; large blocks give higher security at modest cost.
4.2 Finite-Field Domain
All arithmetic occurs in the unsigned 32-bit integer field (mod 2³²).
JavaScript’s >> 0 operator enforces wrap-around consistency with the paper’s equations in ℤ₂³².
Tip: In this implementation, the nonce is automatically stored in the first 4 bytes of each ciphertext or encrypted file.
4.4 Number of Rounds
Rounds follow the adaptive rule rounds = floor(6 + 52 / n),
where n = number of 32-bit words in the block.
128-bit block (4 words): ≈ 19 rounds (default).
64-bit block (2 words): ≈ 32 rounds.
For high-security tests you may set ≥ 32 manual rounds.
4.5 Substitution Layer
The AES S-Box (Table 5 in Ragab et al., 2021) introduces non-linearity and diffusion.
It is applied before encryption and inverse-applied after decryption.
You may experiment with key-dependent S-Boxes for future research.
4.6 Padding
PKCS#7 padding for 8-byte blocks is used.
Padding should remain enabled unless you manage exact block alignment manually.
4.7 Security and Integrity
Enable the HMAC-SHA256 option for authenticity and tamper detection.
Each HMAC adds 64 ASCII hex chars (256 bits) to the ciphertext.
Always use unique keys and nonces to avoid related-key or replay attacks.
4.8 File Handling
Browser limit: ≈ 100 – 500 MB (depending on memory and device).
All binary file types are supported (text, image, video, PDF …).
Throughput ≈ 3–10 MB/s on desktop browsers; ≈ 1–3 MB/s on mobile.
Use the self-test to verify correctness after modifications.
4.10 Summary Recommendations
Scenario
Recommended Settings
Text encryption
128-bit blocks, ≈ 19–32 rounds, HMAC on
File encryption
Random nonce, 128-bit key, HMAC on
Lightweight / IoT
64-bit blocks, ≈ 16 rounds, HMAC off
High-security mode
≥ 128-bit blocks, ≥ 32 rounds, HMAC on, random nonce
5. References
Ragab, A. A., El-Kenawy, E. S. M., Eid, M. M., & Khashan, M. (2021).M-XXTEA: A Modified XXTEA Block Cipher with Enhanced Security.Journal of Ambient Intelligence and Humanized Computing, 12(7), 7909–7925.
https://doi.org/10.1007/s12652-020-02782-6
Needham, R. M., & Wheeler, D. J. (1997).XXTEA: Corrected Block TEA (Tiny Encryption Algorithm).Technical Report, Computer Laboratory, University of Cambridge.xxtea.pdf
Zhang, Q., & Fan, X. (2007).One-time-pad chaotic cryptography based on logistic map.Chaos, Solitons & Fractals, 32(4), 1563–1566.
https://doi.org/10.1016/j.chaos.2005.11.090
Daemen, J., & Rijmen, V. (2002).The Design of Rijndael: AES – The Advanced Encryption Standard.Springer.
(Referenced for S-Box design principles used in M-XXTEA substitution layer.)
Kelsey, J., Schneier, B., Wagner, D., & Hall, C. (1999).Cryptanalytic Attacks on Pseudorandom Number Generators.Fast Software Encryption (FSE ’98), Springer LNCS 1372, 168–188.
(Cited for guidance on avoiding key/nonce reuse in chaos-based designs.)
Stallings, W. (2023).Cryptography and Network Security: Principles and Practice, 9th Edition.Pearson Education.
(General reference for block cipher structures and padding schemes.)
Note: This JavaScript implementation reproduces the essential functional behavior of M-XXTEA
as described in Ragab et al. (2021), extended for web demonstration purposes with HMAC and file support.
For research publication or interoperability testing, ensure compliance with block sizes, substitution table, and chaotic key schedule as specified.