Ver código fonte

AES in python

master
Krzysztof Kwiatkowski 7 anos atrás
pai
commit
95e62c90c5
2 arquivos alterados com 16 adições e 0 exclusões
  1. +1
    -0
      README.md
  2. +15
    -0
      aes.py

+ 1
- 0
README.md Ver arquivo

@@ -0,0 +1 @@
``aes.py`` : AES in python3

+ 15
- 0
aes.py Ver arquivo

@@ -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]))


Carregando…
Cancelar
Salvar