示例#1
0
import sys
import aes
import pad

key = open('chal_13_key', 'rb').read()

c = aes.encrypt_ecb(pad.pkcs7(b'hello', 16), key)
c = bytearray(c)
#c[0] = 4
c = bytes(c)
print(c)

p = aes.decrypt_ecb(c, key)

print(p)
示例#2
0
文件: p25.py 项目: AdrS/cryptopals
def load():
    with open('25.txt', 'r') as f:
        ct = base64.b64decode(''.join(f.read().split()))
    return aes.decrypt_ecb(ct, 'YELLOW SUBMARINE')
示例#3
0
import aes
import base64

with open('7.txt', 'r') as f:
    ct = base64.b64decode(''.join(f.read().split()))

key = "YELLOW SUBMARINE"

print aes.decrypt_ecb(ct, key)
示例#4
0
def unoracle(cipher):
    key = open('chal_13_key', 'rb').read()
    plain = aes.decrypt_ecb(cipher, key).decode('ascii')
    return parse(plain)
示例#5
0
文件: p13.py 项目: AdrS/cryptopals
def is_admin(encrypted_profile):
    profile = parse_query_string(aes.decrypt_ecb(encrypted_profile, key))
    return 'admin' in profile['role']