We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b1ed0d8 commit d7703cdCopy full SHA for d7703cd
1 file changed
tests/protocol/test_version4.py
@@ -37,8 +37,15 @@ def test_decrypt_invalid_mac() -> None:
37
key: bytes = _create_symmetric_key(4, b"0" * 32)
38
39
token: bytes = version4.encrypt(message, key)
40
+
41
# tamper with mac
- token_with_invalid_mac = token[:40] + b"0" + token[41:]
42
+ a_slice = token[40:45]
43
+ if a_slice == b"00000":
44
+ a_slice = b"11111"
45
+ else:
46
+ a_slice = b"00000"
47
+ token_with_invalid_mac = token[:40] + a_slice + token[45:]
48
49
with pytest.raises(InvalidMac):
50
version4.decrypt(token_with_invalid_mac, key)
51
0 commit comments