Skip to content

Commit 97c0565

Browse files
authored
Merge pull request #466 from kentakayama/fix-nonce-modification
Fix nonce modification test
2 parents 6e09b2c + 6954deb commit 97c0565

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/test_algs_symmetric.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ def test_aesctr_key_decrypt_with_invalid_nonce(self):
877877
nonce = token_bytes(16)
878878
encrypted = key.encrypt(b"Hello world!", nonce=nonce)
879879
# alternate the nonce by incrementing the last byte
880-
invalid_nonce = nonce[0:-1] + (nonce[-1] + 1 % 256).to_bytes(1, "big")
880+
invalid_nonce = nonce[0:-1] + ((nonce[-1] + 1) % 256).to_bytes(1, "big")
881881
assert nonce != invalid_nonce
882882
decrypted = key.decrypt(encrypted, nonce=invalid_nonce)
883883
assert encrypted != decrypted
@@ -1035,7 +1035,7 @@ def test_aescbc_key_decrypt_with_invalid_nonce(self):
10351035
nonce = token_bytes(16)
10361036
encrypted = key.encrypt(b"Hello world!", nonce=nonce)
10371037
# alternate the nonce by incrementing the last byte
1038-
invalid_nonce = nonce[0:-1] + (nonce[-1] + 1 % 256).to_bytes(1, "big")
1038+
invalid_nonce = nonce[0:-1] + ((nonce[-1] + 1) % 256).to_bytes(1, "big")
10391039
assert nonce != invalid_nonce
10401040
decrypted = key.decrypt(encrypted, nonce=invalid_nonce)
10411041
assert encrypted != decrypted

0 commit comments

Comments
 (0)