Skip to content

Commit 1003e4f

Browse files
committed
refactor: remove old comments
1 parent 2a3b8d7 commit 1003e4f

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

logic/message.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,6 @@ def send_message_processor(user_data, user_data_lock, contact_id: str, message:
166166
message_encoded = message.encode("utf-8")
167167
try:
168168
# We one-time-pad encrypt the message with padding
169-
#
170-
# NOTE: The padding only protects short-messages which are easy to infer what is said based purely on message length
171-
# With messages larger than padding_limit, we assume the message entropy give enough security to make an adversary assumption
172-
# of message context (almost) useless.
173-
#
174169
message_encrypted, new_pads = otp_encrypt_with_padding(message_encoded, our_pads)
175170
logger.debug("Our old pad size is %d and new size after the message is %d", len(our_pads), len(new_pads))
176171
break
@@ -186,10 +181,9 @@ def send_message_processor(user_data, user_data_lock, contact_id: str, message:
186181

187182

188183

189-
# Unlike in other functions, we truncate pads here and compute the next hash chain regardless of request being successful or not
184+
# Unlike in other functions, we truncate pads here regardless of request being successful or not
190185
# because a malicious server could make our requests fail to force us to re-use the same pad for our next message
191186
# which would break all of our security
192-
193187

194188
our_new_strand_nonce = sha3_512(secrets.token_bytes(XCHACHA20POLY1305_NONCE_LEN))[:XCHACHA20POLY1305_NONCE_LEN]
195189

tests/test_trad_crypto.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ def test_aes_encrypt_decrypt():
3030
assert len(key) == ARGON2ID_OUTPUT_LEN, "key length does not match constant length"
3131
assert len(salt) == ARGON2ID_SALT_LEN, "salt length does not match constant length"
3232

33+
key = key[:32]
34+
3335
# Encrypt plaintext using xChaCha20Poly1305
3436
nonce, ciphertext = encrypt_xchacha20poly1305(key, data)
3537
assert nonce != ciphertext, "Nonce and ciphertext should not be equal"

0 commit comments

Comments
 (0)