Skip to content

Commit b5a50e6

Browse files
committed
feat: add strandlock protocol to smp and messages
1 parent 8cc6c9d commit b5a50e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/crypto.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ def otp_encrypt_with_padding(plaintext: bytes, key: bytes) -> Tuple[bytes, bytes
9595
Ciphertext bytes.
9696
"""
9797

98-
if len(plaintext) < OTP_MAX_BUCKET:
99-
pad_len = OTP_MAX_BUCKET - len(plaintext)
98+
if len(plaintext) <= OTP_MAX_BUCKET - OTP_SIZE_LENGTH:
99+
pad_len = OTP_MAX_BUCKET - OTP_SIZE_LENGTH - len(plaintext)
100100
else:
101101
pad_len = secrets.randbelow(OTP_MAX_RANDOM_PAD + 1)
102102

0 commit comments

Comments
 (0)