Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

Commit 21b17f8

Browse files
committed
refactor: minor cleanups
1 parent c739368 commit 21b17f8

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

core/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
# crypto parameters
1010
AES_GCM_NONCE_LEN = 12 # bytes
1111

12+
OTP_PAD_SIZE = 10240 # bytes
1213
OTP_PADDING_LENGTH = 2 # bytes
1314
OTP_PADDING_LIMIT = 1024 # bytes
1415

core/crypto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def decrypt_kyber_shared_secrets(ciphertext_blob: bytes, private_key: bytes, otp
140140

141141
return shared_secrets[:otp_pad_size]
142142

143-
def generate_kyber_shared_secrets(public_key: bytes, otp_pad_size: int = 10240, algorithm: str = "Kyber1024"):
143+
def generate_kyber_shared_secrets(public_key: bytes, otp_pad_size: int = OTP_PAD_SIZE, algorithm: str = "Kyber1024"):
144144
"""
145145
Generates shared_secrets of size otp_pad_size and returns both the ciphertext list-
146146
and the generated shared_secrets.
@@ -149,7 +149,7 @@ def generate_kyber_shared_secrets(public_key: bytes, otp_pad_size: int = 10240,
149149
150150
151151
Default desired One-time-pad size is set to 10 kilobytes which is meant to accommodate-
152-
10 messages, assuming every message is 1024 bytes with the padding applied.
152+
around 10 messages, assuming every message is 1024 bytes with the padding applied.
153153
154154
155155
We concatenate the ciphertexts together safely because Kyper1024 has a defined fixed-size ciphertext-

logic/pfs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
logger = logging.getLogger(__name__)
1717

18-
# TODO: Add hashchain replay protection
1918
def rotate_ephemeral_keys(user_data, user_data_lock, contact_id, ui_queue) -> None:
2019
with user_data_lock:
2120
user_data_copied = copy.deepcopy(user_data)

0 commit comments

Comments
 (0)