def encryption_oracle(rawInput):
    key = generateAESKey();
    iv = generateAESKey();
    prependAmount = 5 + (getOneRandomByte() % 6); #slight bias...
    appendAmount = 5 + (getOneRandomByte() % 6); #slight bias...
    plaintext = (b'x' * prependAmount) + rawInput + (b'y' * appendAmount);

    if ((getOneRandomByte() & 0x1)):
        return aes_ecb_enc(addPKCS7Padding(plaintext, 16), key);
    else:
        return aes_cbc_enc(addPKCS7Padding(plaintext, 16), key, iv);
dataset/ETHPy150Open reschly/cryptopals/prob11.py/encryption_oracle/original