案例
验证 Apache 生成的 Bcrypt 口令
输入
correct horse battery stapleExpected answer
Match
Match
- 哈希
$2y$04$61rxEDaR3PSKMDB/eWLl/urGkJ9Tv9DqmuoL2gfueVB.Ccqbw/JHq
识别大小写变化且不回显密码
输入
Correct horse battery stapleExpected answer
No match
No match
- 哈希
$2y$04$61rxEDaR3PSKMDB/eWLl/urGkJ9Tv9DqmuoL2gfueVB.Ccqbw/JHq
识别复制密码时多出的末尾空格
输入
correct horse battery staple Expected answer
No match
No match
- 哈希
$2y$04$61rxEDaR3PSKMDB/eWLl/urGkJ9Tv9DqmuoL2gfueVB.Ccqbw/JHq
接受恰好 72 个 ASCII 字节
输入
0123456789012345678901234567890123456789012345678901234567890123456789ABExpected answer
Match
Match
- 哈希
$2y$04$SVHoaZ/YvW3oYrcmsXsZ9epfQq88AwEZG/Vw7.aYp6gRxrSoWFAnq
拒绝第 73 个字节,避免仅匹配前缀
输入
0123456789012345678901234567890123456789012345678901234567890123456789ABCExpected rejection
Message containsBcrypt accepts at most 72 UTF-8 bytes here; longer passwords are rejected to avoid silent truncation.- 哈希
$2y$04$SVHoaZ/YvW3oYrcmsXsZ9epfQq88AwEZG/Vw7.aYp6gRxrSoWFAnq
24 个汉字正好占 72 个 UTF-8 字节
输入
茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶茶Expected answer
Match
Match
- 哈希
$2y$04$obm1IVNBttgCKd9qusGWvOsXYXpnHe.aoyrZEEKXiJLsPhGTikrEu
拒绝不完整的 Bcrypt 哈希
输入
public-exampleExpected rejection
Message containsInvalid bcrypt hash: use a complete 60-character $2a$, $2b$ or $2y$ hash with cost 04–31.- 哈希
$2b$04$broken
dolphin
Reproduce this published regression case and compare the exact result. Bcrypt compare: dolphin.
输入
dolphinExpected answer
Match
Match
- 哈希
$2a$10$qyon0LQCmMxpFFjwWH6Qh.dDdhqntQh./IN0RXCc3XIMILuOYZKgK
invalid salt version
Reproduce this published regression case and compare the exact result. Bcrypt compare: invalid salt version.
输入
passwordExpected rejection
Message containsInvalid bcrypt hash:- 哈希
$ab$04$K.H1WlFDQ/iIo/PiprT/puwluJ5rzuSE5q8D/Fk3NuLgU2aXiGR9m