Преглед изворни кода

x3dh: One more message for safety.

Luther Blissett пре 3 година
родитељ
комит
332ab9122a
1 измењених фајлова са 9 додато и 1 уклоњено
  1. 9 1
      script/research/x3dh/src/main.rs

+ 9 - 1
script/research/x3dh/src/main.rs

@@ -620,7 +620,15 @@ fn main() -> Result<()> {
     let mut bob_ratchet_state_clone = bob_ratchet_state.clone();
     let plaintext = bob_ratchet_state_clone.ratchet_decrypt(header1, &ciphertext1, &[]);
     assert_eq!(plaintext, message_to_bob1);
-    //bob_ratchet_state = bob_ratchet_state_clone;
+    bob_ratchet_state = bob_ratchet_state_clone;
+
+    let message_to_alice = b"weaponised autism";
+    let (header, ciphertext) = bob_ratchet_state.ratchet_encrypt(message_to_alice, &[]);
+
+    let mut alice_ratchet_state_clone = alice_ratchet_state.clone();
+    let plaintext = alice_ratchet_state_clone.ratchet_decrypt(header, &ciphertext, &[]);
+    assert_eq!(plaintext, message_to_alice);
+    //alice_ratchet_state = alice_ratchet_state_clone;
 
     Ok(())
 }