Exemplo n.º 1
0
function random_enc($key)
{
    $strings = array('MDAwMDAwTm93IHRoYXQgdGhlIHBhcnR5IGlzIGp1bXBpbmc=', 'MDAwMDAxV2l0aCB0aGUgYmFzcyBraWNrZWQgaW4gYW5kIHRoZSBWZWdhJ3MgYXJlIHB1bXBpbic=', 'MDAwMDAyUXVpY2sgdG8gdGhlIHBvaW50LCB0byB0aGUgcG9pbnQsIG5vIGZha2luZw==', 'MDAwMDAzQ29va2luZyBNQydzIGxpa2UgYSBwb3VuZCBvZiBiYWNvbg==', 'MDAwMDA0QnVybmluZyAnZW0sIGlmIHlvdSBhaW4ndCBxdWljayBhbmQgbmltYmxl', 'MDAwMDA1SSBnbyBjcmF6eSB3aGVuIEkgaGVhciBhIGN5bWJhbA==', 'MDAwMDA2QW5kIGEgaGlnaCBoYXQgd2l0aCBhIHNvdXBlZCB1cCB0ZW1wbw==', 'MDAwMDA3SSdtIG9uIGEgcm9sbCwgaXQncyB0aW1lIHRvIGdvIHNvbG8=', 'MDAwMDA4b2xsaW4nIGluIG15IGZpdmUgcG9pbnQgb2g=', 'MDAwMDA5aXRoIG15IHJhZy10b3AgZG93biBzbyBteSBoYWlyIGNhbiBibG93');
    $iv = random_aes_key(16);
    $enc = encrypt_aes_cbc($key, base64_decode($strings[rand(0, count($strings) - 1)]), $iv);
    return array($iv, $enc);
}
Exemplo n.º 2
0
function encryption_oracle($data, $iv = '')
{
    $modes = array('ecb', 'cbc');
    $key = random_aes_key(32);
    $data = random_aes_key(rand(5, 10)) . $data . random_aes_key(rand(5, 10));
    return $modes[rand(0, 1)] == 'ecb' ? mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, 'ecb') : encrypt_aes_cbc($key, $data, random_aes_key(16));
}
Exemplo n.º 3
0
function aes_cbc_cookie($string, $key)
{
    $string = preg_replace('/(=|;)/', "'\$1'", $string);
    $string = "comment1=cooking%20MCs;userdata={$string};comment2=%20like%20a%20pound%20of%20bacon";
    return encrypt_aes_cbc($key, $string, 'YELLOW SUBMARINE');
}