Skip to content

[feat] add DES, SM4, and RC4 algorithm unit tests - #15

Merged
h1s97x merged 1 commit into
mainfrom
feature/complete-tests
May 16, 2026
Merged

[feat] add DES, SM4, and RC4 algorithm unit tests#15
h1s97x merged 1 commit into
mainfrom
feature/complete-tests

Conversation

@h1s97x

Copy link
Copy Markdown
Owner

变更内容

新增测试文件

tests/unit/test_des.py (15 测试用例)

测试类内容
TestDESConstantsPC1, PC2, LS, IP, FP, S-boxes, P, E, CP1, CP2
TestDESKeySchedule16 轮密钥生成
TestDESMathProperties数学性质验证

tests/unit/test_sm4.py (20 测试用例)

测试类内容
TestSM4ConstantsIV, FK, CK, Sbox 常量
TestSM4Functionstau, L, T 函数
TestSM4KeyExpansion32 轮密钥扩展
TestSM4EncryptDecrypt加解密往返测试

tests/unit/test_rc4.py (13 测试用例)

测试类内容
TestRC4Constants常量验证
TestRC4KSAKSA 初始化和确定性
TestRC4PRGAPRGA 密钥流生成
TestRC4EncryptDecrypt加解密对称性

更新的文件

  • tests/unit/test_ecc.py - 修复 PRIVATE_KEY_SIZE 引用

验证结果

  • pytest: 216 passed (新增 48 个测试)

Add tests/unit/test_des.py (15 test cases):
- DES constants: PC1, PC2, LS, IP, FP, S-boxes, P, E, CP1, CP2
- DES key schedule: 16 round keys generation
- DES mathematical properties
Add tests/unit/test_sm4.py (20 test cases):
- SM4 constants: IV, FK, CK, Sbox
- SM4 functions: tau, L, T
- SM4 key expansion: 32 rounds
- SM4 encryption/decryption roundtrip
Add tests/unit/test_rc4.py (13 test cases):
- RC4 constants and functions
- KSA initialization and determinism
- PRGA keystream generation
- RC4 encrypt/decrypt symmetry
Also update tests/unit/test_ecc.py:
- Fix key_size reference (was PRIVATE_KEY_SIZE)
@h1s97xh1s97x self-assigned this May 16, 2026
@h1s97x
h1s97x merged commit a73a8b7 into mainMay 16, 2026
3 checks passed
@h1s97x
h1s97x deleted the feature/complete-tests branch May 16, 2026 15:19
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@h1s97x