WIP: Limit auth_info to 10 bits
This commit is contained in:
parent
32fa85636a
commit
ae2a253a13
1 changed files with 2 additions and 1 deletions
|
@ -53,7 +53,8 @@ impl ProductKey {
|
||||||
None => {
|
None => {
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
let random: BigInt = rng.sample(RandomBits::new(32));
|
let random: BigInt = rng.sample(RandomBits::new(32));
|
||||||
u32::from_be_bytes(random.to_bytes_be().1[0..4].try_into().unwrap())
|
let raw = u32::from_be_bytes(random.to_bytes_be().1[0..4].try_into().unwrap());
|
||||||
|
raw % (bitmask(10) as u32)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue