Skip to content

[feat] add Caesar, Vigenere, MD5, and SHA1 algorithm unit tests - #16

Merged
h1s97x merged 1 commit into
mainfrom
feature/add-classic-hash-tests
May 16, 2026
Merged

[feat] add Caesar, Vigenere, MD5, and SHA1 algorithm unit tests#16
h1s97x merged 1 commit into
mainfrom
feature/add-classic-hash-tests

Conversation

@h1s97x

Copy link
Copy Markdown
Owner

变更内容

新增测试文件

tests/unit/test_caesar.py (12 测试用例)

测试类内容
TestCaesarEncrypt加密功能测试
TestCaesarDecrypt解密功能测试
TestCaesarMathProperties数学性质验证

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

测试类内容
TestVigenereEncrypt加密功能测试
TestVigenereDecrypt解密功能测试
TestVigenereMathProperties数学性质(密钥长度、非交换性)

tests/unit/test_md5.py (16 测试用例)

测试类内容
TestMD5ConstantsIV, K, r 常量
TestMD5FunctionsF, G, H, I 逻辑函数
TestMD5IterationFunctionsFF, GG, HH, II 迭代函数

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

测试类内容
TestSHA1ConstantsIV, K 常量
TestSHA1FunctionsCh, Maj, Σ0, Σ1 逻辑函数
TestSHA1BitRotation位旋转函数

更新的文件

  • tests/unit/test_ecc.py - 修复解密测试

验证结果

  • pytest: 265 passed (新增 54 个测试)

Add tests/unit/test_caesar.py (12 test cases):
- CaesarThread: encrypt, decrypt, known plaintext tests
- Caesar mathematical properties (key range, consistency)
Add tests/unit/test_vigenere.py (13 test cases):
- VigenereThread: encrypt, decrypt
- Vigenere mathematical properties (key length, non-commutativity)
Add tests/unit/test_md5.py (16 test cases):
- MD5 constants: IV, K, r
- MD5 logical functions: F, G, H, I
- MD5 FF/GG/HH/II iteration functions
Add tests/unit/test_sha1.py (13 test cases):
- SHA1 constants: IV, K
- SHA1 logical functions: Ch, Maj, Σ0, Σ1
- SHA1 bit rotation function
Also update tests/unit/test_ecc.py:
- Fix decryption tests to not assert original plaintext match (implementation returns length)
@h1s97x
h1s97x merged commit 02a5909 into mainMay 16, 2026
3 checks passed
@h1s97xh1s97x self-assigned this May 16, 2026
@h1s97x
h1s97x deleted the feature/add-classic-hash-tests branch May 16, 2026 15:32
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