tor-hscrypto: implement Rng.gen() for RendCookie
This commit is contained in:
parent
dc95c7874a
commit
a50016b3da
|
@ -4197,6 +4197,7 @@ dependencies = [
|
|||
"humantime 2.1.0",
|
||||
"itertools",
|
||||
"paste",
|
||||
"rand 0.8.5",
|
||||
"rand_core 0.6.4",
|
||||
"safelog",
|
||||
"serde",
|
||||
|
|
|
@ -21,6 +21,7 @@ derive_more = "0.99.3"
|
|||
digest = "0.10.0"
|
||||
itertools = "0.10.1"
|
||||
paste = "1"
|
||||
rand = "0.8"
|
||||
rand_core = "0.6.2"
|
||||
safelog = { path = "../safelog", version = "0.3.1" }
|
||||
serde = { version = "1.0.103", features = ["derive"] }
|
||||
|
|
|
@ -91,3 +91,9 @@ define_bytes! {
|
|||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
pub struct RendCookie([u8; REND_COOKIE_LEN]);
|
||||
}
|
||||
|
||||
impl rand::distributions::Distribution<RendCookie> for rand::distributions::Standard {
|
||||
fn sample<R: rand::Rng + ?Sized>(&self, rng: &mut R) -> RendCookie {
|
||||
RendCookie(rng.gen::<[u8; REND_COOKIE_LEN]>().into())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue