Skip to content

use from_seed with 32 bytes instead of 8#64

Merged
0xjei merged 1 commit into
mainfrom
bug/64-truncation
Jun 10, 2026
Merged

use from_seed with 32 bytes instead of 8#64
0xjei merged 1 commit into
mainfrom
bug/64-truncation

Conversation

@0xjei

@0xjei 0xjei commented Jun 10, 2026

Copy link
Copy Markdown
Member

avoid using [ChaCha20::from_u64_seed()](https://docs.rs/rand_core/0.10.0/rand_core/trait.SeedableRng.html#method.seed_from_u64) for Shamir.

@0xjei 0xjei self-assigned this Jun 10, 2026
/// Used to derive independent per-task RNGs for parallel sampling without
/// sharing the caller's RNG across threads.
pub(crate) fn fork_seed<R: RngCore + CryptoRng>(rng: &mut R) -> [u8; 32] {
let mut seed = [0u8; 32];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does u8 here imply some entropy loss?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0u8 is just Rust buffer init, not the seed value..

the seed value comes from rng.fill_bytes(...)

@0xjei 0xjei requested review from auryn-macmillan and ctrlc03 June 10, 2026 15:05
@0xjei 0xjei mentioned this pull request Jun 10, 2026
@0xjei 0xjei merged commit 3d7aeed into main Jun 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants