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
697
-
// be deserialized to a ChaChaRng
698
-
// 2. re-serializing the resultant object produces exactly the original string
699
-
//
700
-
// Condition 2 is stronger than necessary: an equivalent serialization (e.g. with field order
701
-
// permuted, or whitespace differences) would also be admissible, but would fail this test.
702
-
// However testing for equivalence of serialized data is difficult, and there shouldn't be any
703
-
// reason we need to violate the stronger-than-needed condition, e.g. by changing the field
704
-
// definition order.
705
-
#[cfg(feature = "serde")]
706
-
#[test]
707
-
fntest_chacha_serde_format_stability(){
708
-
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}"#;
709
-
let r:ChaChaRng = serde_json::from_str(j).unwrap();
0 commit comments