| 1 | use crate::password; |
| 2 | |
| 3 | #[test] |
| 4 | fn test_encrypt_scram_sha_256() { |
| 5 | // Specify the salt to make the test deterministic. Any bytes will do. |
| 6 | let salt: [u8; 16] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]; |
| 7 | assert_eq!( |
| 8 | password::scram_sha_256_salt(b"secret", salt), |
| 9 | "SCRAM-SHA-256$4096:AQIDBAUGBwgJCgsMDQ4PEA==$8rrDg00OqaiWXJ7p+sCgHEIaBSHY89ZJl3mfIsf32oY=:05L1f+yZbiN8O0AnO40Og85NNRhvzTS57naKRWCcsIA=" |
| 10 | ); |
| 11 | } |
| 12 | |
| 13 | #[test] |
| 14 | fn test_encrypt_md5() { |
| 15 | assert_eq!( |
| 16 | password::md5(b"secret", "foo"), |
| 17 | "md54ab2c5d00339c4b2a4e921d2dc4edec7" |
| 18 | ); |
| 19 | } |