You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See discussion from: rust-random/rand#1101
Being able to easily serialize the state of a cryptographic RNG is a
footgun that risks both duplicating the keystream (which can lead to
e.g. nonce reuse) or exposing it.
// 1. a hard-coded serialization demonstrating the format at time of initial release can still
699
-
// be deserialized to a ChaChaRng
700
-
// 2. re-serializing the resultant object produces exactly the original string
701
-
//
702
-
// Condition 2 is stronger than necessary: an equivalent serialization (e.g. with field order
703
-
// permuted, or whitespace differences) would also be admissible, but would fail this test.
704
-
// However testing for equivalence of serialized data is difficult, and there shouldn't be any
705
-
// reason we need to violate the stronger-than-needed condition, e.g. by changing the field
706
-
// definition order.
707
-
#[cfg(feature = "serde")]
708
-
#[test]
709
-
fntest_chacha_serde_format_stability(){
710
-
let j = r#"{"seed":[4,8,15,16,23,42,4,8,15,16,23,42,4,8,15,16,23,42,4,8,15,16,23,42,4,8,15,16,23,42,4,8],"stream":27182818284,"word_pos":314159265359}"#;
711
-
let r:ChaChaRng = serde_json::from_str(j).unwrap();
0 commit comments