diff --git a/README.md b/README.md index e69de29..d2b51d3 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +``aes.py`` : AES in python3 \ No newline at end of file diff --git a/aes.py b/aes.py new file mode 100644 index 0000000..84b9c5e --- /dev/null +++ b/aes.py @@ -0,0 +1,15 @@ +from Crypto.Cipher import AES + +k=0x4645444342413938373635343332310a +m=0x97B3C8E55AEBAD9B9A802AC020272BCE + +key=(k).to_bytes(16, byteorder='big') +msg=(m).to_bytes(16, byteorder='big') + +obj = AES.new(key, AES.MODE_ECB) +enc = obj.encrypt(msg) +dec = obj.decrypt(enc) + +print("ENC=" + ''.join(['{:02x}'.format(i) for i in enc])) +print("DEC=" + ''.join(['{:02x}'.format(i) for i in dec])) +