The cryptography used to generate passwords and encrypted messages exactly as the No Chat Reports Mod for Minecraft does.
```Rust use ncrencryption::{decryptwithpassphrase, decodeand_verify};
let passphrase = b"secret"; // Setting in NCR // "Hello, world!" sent as a message in chat: let ciphertext = base64::decode("q2JCS/M3yMnz+MtXDn4dd6xyqN94Dao=").unwrap();
let decrypted = decryptwithpassphrase(&ciphertext, passphrase); let decoded = decodeandverify(&decrypted);
assert_eq!(decoded, Ok("#%Hello, world!")) ```
From reading the Source Code on Github it becomes clear how the mod does encryption:
PBKDF2WithHmacSHA1
with a hardcoded salt and 65536 iterations to make your passphrase
into a hash of 16 bytes. This process takes the longestAES-CFB8
encryption"#%"
is added as a prefix to the message before encrypting)Decrypting then is very similar, just in reverse:
"#%"
, the rest is printed decrypted in the chatBy default fastpbkdf2
doesn't compile for Windows, see here
This crate will use ring
by default on Windows which is slower than fastpbkdf2
, see here
If you're concerned with performance it is recommended to use the Windows Subsystem for Linux.