Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion wacore/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ impl core::fmt::Write for Utf8Sink<'_> {
impl MessageUtils {
fn random_pad_len() -> u8 {
use rand::RngExt;
let mut rng = rand::make_rng::<rand::rngs::StdRng>();
// The thread-local generator directly: seeding a fresh StdRng per
// plaintext ran a full ChaCha key schedule to produce one byte.
let mut rng = rand::rng();
// Uniform 1..=16, matching WA Web / whatsmeow (rand%16 + 1). The prior
// `& 0x0F` with a 0->15 remap skewed toward 15 and never produced 16.
(rng.random::<u8>() & 0x0F) + 1
Expand Down
Loading