Closed l4l closed 4 years ago
Hi @l4l, so I was taking a look at your changes. I see that because rand
can't work with std
thread_rng
is not available and you need to pass a Rng
to the dealer
. Is it possible to create that number generator or does it have to be provided by the crate user?
I guess rand_chacha might do the thing, like that:
let sharks = sharks::Sharks(2);
let mut rand = rand_chacha::ChaCha8Rng::from_seed([0x90; 32]);
let secret = [1, 2, 3, 4, 5, 6];
let shares = sharks.dealer_with_rng(&mut rand, &secret);
I think it is better give a user to decide what Rng
to use, if there is no rand/std. Particularly, there can be some hardware entropy source, so it is better implement RngCore, rather than use rand_chacha.
Hi @l4l! I've pushed a new commit simplifying a bit the RNG usage as well as updating the docs and tests. Also pinned a new version. Let me know if you like it and make any improvement if you will. :smile:
Looks great, I've also added a few fixes: one un-ignores doc-tests via the cfg blocks (that look quite clumsy, but at least checked in ci) and the second one is a test refactorings, so that final diff is smaller (and hopefully more readable as well).
Hi! Thanks for your contribution. I will review it and hopefully merge it to
master