docs: cipher 向量独立验算通过,修正长度断言(96 hex 字符,非 64)
Co-Authored-By: Claude <[email protected]>
This commit is contained in:
1 parent
6b8c30ebb3
commit
4a7805ad65
1 file changed
+11
@@ -119,6 +119,17 @@ encrypt_password("123456")
|
||||
== "d4958348e22108119b3ef57b022c83f4bf857dd0b247eaab15b9a43d47ee3c503900f7135bf0de255bc33620c3cdc02b"
|
||||
```
|
||||
|
||||
**中间值(已用 openssl 独立验算通过,2026-10-25)**:
|
||||
```
|
||||
md5_hex("EY8WePvjM5GGwQzn") = "05b0175907a859751f57a04d5a5ee9ac" ← 32 字符,当 32 个 ASCII 字节用
|
||||
md5_hex("123456") = "e10adc3949ba59abbe56e057f20f883e" ← 32 字符,当 32 个 ASCII 字节用
|
||||
```
|
||||
|
||||
🔴 **输出长度**:输入是 32 字节(= 16 的整数倍)⇒ PKCS7 **补满一整块 16 字节** ⇒
|
||||
密文 48 字节 ⇒ hex **96 个字符**(不是 64)。
|
||||
自查:若你的实现输出 64 个 hex 字符 ⇒ 漏了 PKCS7 填充。
|
||||
解密时必须**去掉 PKCS7 填充**;填充非法 ⇒ 返回 `None`。
|
||||
|
||||
**口令比对**:库内存 `md5(明文)`;登录时 `decrypt_to_md5(密文)` 得到 `md5(明文)` ⇒ **大小写不敏感**比较。
|
||||
|
||||
**依赖版本组合(别混用)**:`aes 0.8` + `ecb 0.1`(cipher 0.4 家族);`md-5 0.10`(crate 名 `md5`,`use md5::{Digest, Md5};`)。
|
||||
|
||||
Reference in new issue
Block a user