From bfa216de546f1013401c9c4f28a163c0ad27f6e3 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Wed, 4 Sep 2024 19:08:18 +0200 Subject: [PATCH] Cleanup --- RNS/Destination.py | 6 ++++-- RNS/Identity.py | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/RNS/Destination.py b/RNS/Destination.py index 92e4735..7c05121 100755 --- a/RNS/Destination.py +++ b/RNS/Destination.py @@ -198,7 +198,7 @@ class Destination: self.ratchets_path = ratchets_path self.persist_ratchets() - RNS.log("Enabled ratchets on "+str(self), RNS.LOG_DEBUG) # TODO: Remove + RNS.log("Ratchets enabled on "+str(self), RNS.LOG_DEBUG) # TODO: Remove return True else: @@ -271,7 +271,9 @@ class Destination: if self.ratchets != None: self.rotate_ratchets() ratchet = RNS.Identity._ratchet_public_bytes(self.ratchets[0]) - RNS.log(f"Including {len(ratchet)*8}-bit ratchet {RNS.hexrep(ratchet)} in announce", RNS.LOG_DEBUG) # TODO: Remove + + # TODO: Remove debug output + RNS.log(f"Including ratchet {RNS.prettyhexrep(RNS.Identity.truncated_hash(ratchet))} in announce", RNS.LOG_DEBUG) if app_data == None and self.default_app_data != None: if isinstance(self.default_app_data, bytes): diff --git a/RNS/Identity.py b/RNS/Identity.py index c778663..8ce5633 100644 --- a/RNS/Identity.py +++ b/RNS/Identity.py @@ -237,7 +237,7 @@ class Identity: @staticmethod def _remember_ratchet(destination_hash, ratchet): - RNS.log(f"Remembering ratchet {RNS.hexrep(ratchet)} for {RNS.prettyhexrep(destination_hash)}", RNS.LOG_DEBUG) # TODO: Remove + RNS.log(f"Remembering ratchet {RNS.prettyhexrep(Identity.truncated_hash(ratchet))} for {RNS.prettyhexrep(destination_hash)}", RNS.LOG_DEBUG) # TODO: Remove try: Identity.known_ratchets[destination_hash] = ratchet hexhash = RNS.hexrep(destination_hash, delimit=False) @@ -572,7 +572,7 @@ class Identity: ephemeral_pub_bytes = ephemeral_key.public_key().public_bytes() if ratchet != None: - RNS.log(f"Encrypting with ratchet {RNS.hexrep(ratchet)}", RNS.LOG_DEBUG) # TODO: Remove + RNS.log(f"Encrypting with ratchet {RNS.prettyhexrep(RNS.Identity.truncated_hash(ratchet))}", RNS.LOG_DEBUG) # TODO: Remove target_public_key = X25519PublicKey.from_public_bytes(ratchet) else: target_public_key = self.pub @@ -625,7 +625,10 @@ class Identity: fernet = Fernet(derived_key) plaintext = fernet.decrypt(ciphertext) - RNS.log(f"Decrypted with ratchet {RNS.hexrep(ratchet_prv.public_key().public_bytes())}", RNS.LOG_DEBUG) # TODO: Remove + + # TODO: Remove + RNS.log(f"Decrypted with ratchet {RNS.prettyhexrep(RNS.Identity.truncated_hash(ratchet_prv.public_key().public_bytes()))}", RNS.LOG_DEBUG) + break except Exception as e: