[−][src]Function classygroup::create_discriminant
pub fn create_discriminant<D, T>(seed: &[u8], length: u16) -> T where
D: Digest + Default + FixedOutput,
T: BigNumExt,
Create a discriminant from a seed (a byte string) and a bit length (a
u16
). The discriminant is guaranteed to be a negative prime number that
fits in length
bits, except with negligible probability (less than
2^(-100)). It is also guaranteed to equal 7 modulo 8.
This function uses blake2b to expand the seed. Therefore, different seeds
will result in completely different discriminants with overwhelming
probability, unless length
is very small. However, this function is
deterministic: if it is called twice with identical seeds and lengths, it
will always return the same discriminant.
This function is guaranteed not to panic for any inputs whatsoever, unless memory allocation fails and the allocator in use panics in that case.