ソースを参照

AES in python

master
コミット
95e62c90c5
2個のファイルの変更16行の追加0行の削除
  1. +1
    -0
      README.md
  2. +15
    -0
      aes.py

+ 1
- 0
README.md ファイルの表示

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

+ 15
- 0
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]))


読み込み中…
キャンセル
保存