You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
529 B
29 lines
529 B
6 years ago
|
try:
|
||
2 years ago
|
from cryptolib import aes
|
||
6 years ago
|
except ImportError:
|
||
|
print("SKIP")
|
||
|
raise SystemExit
|
||
|
|
||
|
|
||
|
def _new(k, ctr_initial):
|
||
|
return aes(k, 6, ctr_initial)
|
||
|
|
||
|
|
||
|
try:
|
||
5 years ago
|
_new(b"x" * 16, b"x" * 16)
|
||
6 years ago
|
except ValueError as e:
|
||
|
# is CTR support disabled?
|
||
|
if e.args[0] == "mode":
|
||
|
print("SKIP")
|
||
|
raise SystemExit
|
||
|
raise e
|
||
|
|
||
|
crypto = _new(b"1234" * 4, b"5678" * 4)
|
||
5 years ago
|
enc = crypto.encrypt(b"a")
|
||
6 years ago
|
print(enc)
|
||
5 years ago
|
enc += crypto.encrypt(b"b" * 1000)
|
||
6 years ago
|
print(enc)
|
||
|
|
||
|
crypto = _new(b"1234" * 4, b"5678" * 4)
|
||
|
print(crypto.decrypt(enc))
|