Equivalent neural network learning of block cipher algorithms based on thought-chain
Received date: 2025-09-24
Online published: 2026-05-22
Supported by
This paper is supported by the National Natural Science Foundation of China (62372022) and the Beijing Natural Science Foundation (L251040).
Copyright
Neural networks, as powerful nonlinear modeling tools, demonstrate unique advantages across multiple fields and have recently begun to show their potential in the field of cryptography, providing new technical insights for encrypted data analysis. The deep neural network model is utilized to learn the mapping relationship from the internal functions of the known encryption algorithm, and an encryption neural network model functionally equivalent to the original algorithm is constructed based on the chain of thought pattern. Through the meticulous design of efficient neural network structures and the construction of appropriate training datasets, the equivalent neural network simulation of basic operations (XOR, OR, AND, modular addition, cyclic shift, S-box transformation, row shift and column mixing) for block cipher algorithms is realized. On this basis, the learning of encryption and key expansion functions is conducted on four typical block cipher algorithms, namely AES-128, SM4, SIMON32/64 and SPECK64/96, and the accuracy and stability of the model in different application scenarios are verified. Experimental results show that the simulation success rate of the model on AES-128, SM4 and SIMON32/64 reaches 100%, and the success rate on SPECK64/96 reaches 97%. The equivalent neural network learning of block cipher algorithms based on chain of thought cannot only accurately learn the operation logic of the original encryption algorithm, but also effectively simulate its key expansion process, with high simulation accuracy and stability.
Wang Wendong , Cao Xinying , Yuan Chao , Li Dawei , Lü Jiqiang . Equivalent neural network learning of block cipher algorithms based on thought-chain[J]. Journal of Cybersecurity, 2026 : 1 -15 . DOI: 10.20172/j.issn.2097-3136.260522
表 1 各个基本模块的模型超参数Table 1 Model hyperparameters of each basic module |
| 基本模块 | 神经网络 | 训练集 | 验证集 | 测试集 |
| XOR OR AND | LSTM ResNet | 5×103 | 103 | 104 |
| 32位模加法 | LSTM ResNet | 5×103 | 103 | 104 |
| 循环 移位 | LSTM ResNet | 216 | 215 | 104 |
| S盒 | LSTM ResNet | 106/217 | 105/216 | 104 |
| 行位移 列混淆 | ResNet | 216 | 215 | 104 |
表 2 基于随机森林的37 → 32随机右移训练结果Table 2 Training results of 37 → 32 random right shift based on random forest |
| 数据集大小 | 树的个数 | 模型复杂度 | 准确率 |
| 557MB | 0 | ||
| 10 000 | 100 | 555MB | 0 |
| 100 000 | 100 | 5.42GB | 18.37% |
| 1 000 000 | 100 | 54.2GB | 92.66% |
表 3 基于随机森林的32 → 32固定右移8位训练结果Table 3 Training results of 32 → 32 fixed 8-bit right shift based on random forest |
| 训练数据集大小 | 模型复杂度 | 准确率 |
| 100 | 5.83MB | 0 |
| 1 000 | 55.8MB | 52% |
| 10 000 | 555MB | 98.34% |
| 100 000 | 5.42GB | 99.99% |
表 4 轮函数基本模块的训练结果Table 4 Training results of the basic module of round functions |
| 子模型 | 输入比特数 | 输出比特数 | 复杂度 | 准确率 |
| XOR\OR\AND | 16+16 | 16 | 44KB | 100% |
| 32+32 | 32 | 44KB | 100% | |
| 32位模加法 | 16+16 | 16 | 100% | |
| 32+32 | 32 | 99.9% | ||
| 循环移位 | 16 | 16 | 100% | |
| 32 | 32 | 100% | ||
| S盒 | 16 | 1 | 100% | |
| 行位移 | 32 | 32 | 100% | |
| 列混淆 | 8 | 8 | 482KB | 100% |
表 5 SPECK64/96算法各模块的准确率及模型复杂度Table 5 Accuracy of each module of SPECK64/96 algorithm and the complexity of the model |
| 基本运算 | 次/完整加密 | 模型复杂度 | 准确率 |
| 32bit循环右移8bit | 51 | 100% | |
| 32bit循环左移3bit | 51 | 100% | |
| 32bit模加法 | 51 | 99.9% | |
| 32bit异或运算 | 102 | 44KB | 100% |
表 6 SIMON32/64各模块的准确率及模型复杂度Table 6 Accuracy of each module of SIMON32/64 and the complexity of the model |
| 基本运算 | 次/完整加密 | 模型复杂度 | 准确率 |
| 16bit异或运算 | 264 | 44KB | 100% |
| 16bit与运算 | 32 | 44KB | 100% |
| 16bit循环左移1/2/8bit | 32/32/32 | 100% | |
| 16bit循环右移1/3/4bit | 28/28/28 | 100% |
表 7 行位移模块在不同超参数下的测试集准确率Table 7 Accuracy rate of the test set under different hyperparameters of the row displacement module |
| 序号 | 深度 | 卷积核 | 丢弃率 | 准确率 |
| 1 | 4 | 2 | 0.2 | 0 |
| 2 | 4 | 3 | 0.2 | 0 |
| 3 | 6 | 2 | 0.2 | 0 |
| 4 | 6 | 3 | 0.2 | 0.1% |
| 5 | 8 | 2 | 0.2 | 0 |
| 6 | 8 | 3 | 0.2 | 0 |
| 7 | 10 | 2 | 0.2 | 0 |
| 8 | 10 | 3 | 0.2 | 0 |
| 9 | 4 | 2 | 0.4 | 0 |
| 10 | 4 | 3 | 0.4 | 0 |
| 11 | 6 | 2 | 0.4 | 0 |
| 12 | 6 | 3 | 0.4 | 0 |
| 13 | 8 | 2 | 0.4 | 0 |
| 14 | 8 | 3 | 0.4 | 0 |
| 15 | 10 | 2 | 0.4 | 0 |
| 16 | 10 | 3 | 0.4 | 0 |
| 17 | 4 | 2 | 0.6 | 0 |
| 18 | 4 | 3 | 0.6 | 0 |
| 19 | 6 | 2 | 0.6 | 0 |
| 20 | 6 | 3 | 0.6 | 0 |
| 21 | 8 | 2 | 0.6 | 0 |
| 22 | 8 | 3 | 0.6 | 0 |
| 23 | 10 | 2 | 0.6 | 0 |
| 24 | 10 | 3 | 0.6 | 0 |
| 25 | 4 | 2 | 0.8 | 0 |
| 26 | 4 | 3 | 0.8 | 0 |
| 27 | 6 | 2 | 0.8 | 0 |
| 28 | 6 | 3 | 0.8 | 0 |
| 29 | 8 | 2 | 0.8 | 0 |
| 30 | 8 | 3 | 0.8 | 0 |
| 31 | 10 | 2 | 0.8 | 0 |
| 32 | 10 | 3 | 0.8 | 0 |
表 8 AES-128各模块的准确率及模型复杂度Table 8 Accuracy rate and model complexity of each module of AES-128 |
| 基本运算 | 次/完整加密 | 复杂度 | 准确率 |
| S盒 | 160 | 44KB | 100% |
| xtime运算 | 72 | 44KB | 100% |
| 8bit异或运算 | 36 | 100% | |
| 128bit异或运算 | 11 | 100% | |
| 32bit循环左移8/16/24位 | 10/10/10 | 100% |
表 9 SM4各模块的准确率及模型复杂度Table 9 Accuracy rate and model complexity of each module of SM4 |
| 基本运算 | 次/完整加密 | 复杂度 | 准确率 |
| S盒 | 256 | 44KB | 100% |
| 32bit异或运算 | 448 | 1173KB | 100% |
| 32bit循环左移2/10/18/24bit | 32/32/32/32 | 1173KB | 100% |
| 32bit循环左移13/23bit | 32/32 | 1173KB | 100% |
| 1 |
Tieleman T, Hinton G. Lecture 6.5-rmsprop: Divide the gradient by a running average of its recent magnitude[EB/OL]. Coursera: Neural Networks for Machine Learning, 2012: 26-30. https://www.cs.toronto.edu/~tijmen/csc321/slides/lecture_slides_lec6.pdf
|
| 2 |
Zeiler M D, Fergus R. Visualizing and understanding convolutional networks[M]//Computer Vision – ECCV 2014. ChamSpringer International Publishing, 2014: 818-833.
|
| 3 |
Kanungo D P, Arora M K, Sarkar S, et al. A comparative study of conventional, ANN black box, fuzzy and combined neural and fuzzy weighting procedures for landslide susceptibility zonation in Darjeeling Himalayas[J]. Engineering Geology, 2006, 85 (3/4): 347- 366.
|
| 4 |
Sjöberg J, Zhang Q H, Ljung L, et al. Nonlinear black-box modeling in system identification: a unified overview[J]. Automatica, 1995, 31(12): 1691-1724.
|
| 5 |
Jang J S, R. Fuzzy modeling using generalized neural networks and kalman filter algorithm[C]//Proceedings of the 9th National Conference on Artificial Intelligence, Anaheim, 1991, 2: 762-767.
|
| 6 |
Jang J S R. ANFIS: adaptive-network-based fuzzy inference system[J]. IEEE Transactions on Systems, Man, and Cybernetics, 1993, 23 (3): 665- 685.
|
| 7 |
Kwan H K, Cai Y L. A fuzzy neural network and its application to pattern recognition[J]. IEEE Transactions on Fuzzy Systems, 1994, 2 (3): 185- 193.
|
| 8 |
Godfrey L B, Gashler M S. A parameterized activation function for learning fuzzy logic operations in deep neural networks[C]//Proceedings of the 2017 IEEE International Conference on Systems, Man, and Cybernetics (SMC). Piscataway: IEEE Press, 2017: 740-745.
|
| 9 |
Gohr A. Improving attacks on round-reduced Speck32/64 using deep learning[M]//Advances in Cryptology – CRYPTO 2019. Cham: Springer International Publishing, 2019: 150-179.
|
| 10 |
陈怡, 包珍珍, 申焱天, 等. 用于大状态分组密码的深度学习辅助密钥恢复框架[J]. 中国科学: 信息科学, 2023, 53 (7): 1348- 1367.
Chen Y, Bao Z Z, Shen Y T, et al. A deep learning-aided key recovery framework for large-state block ciphers[J]. Scientia Sinica (Informationis), 2023, 53 (7): 1348- 1367.
|
| 11 |
Zhang R L, Shu R, Wei Y Z, et al. A novel S-box generation methodology based on the optimized GAN model[J]. Computers, Materials & Continua, 2023, 76(2): 1911-1927
|
| 12 |
Beaulieu R, Shors D, Smith J, et al. The SIMON and SPECK lightweight block ciphers[C]//Proceedings of the 52nd Annual Design Automation Conference. New York: ACM, 2015: 1-6.
|
| 13 |
NIST. Announcing approval of federal information processing standard(FIPS)197, advanced encryption standard (AES)[EB/OL]. [2025-09-23]. http://csrc.nist.gov/CryptoToolkit/aes/frn-fips197.pdf.
|
| 14 |
GM/T 0002—2012 SM4 分组密码算法 [S]. 北京: 国家密码管理局, 2012.
GM/T 0002—2012 SM4 block cipher algorithm[S]. Beijing: State Cryptography Administration of China, 2012.
|
| 15 |
GB/T 32907—2016 信息安全技术 SM4 分组密码算法[S]. 北京: 中国标准出版社, 2016.
GB/T 32907—2016 Information security technology—SM4 block cipher algorithm[S]. Beijing: Standards Press of China, 2016.
|
/
| 〈 |
|
〉 |