function randomlyEncryptECBorCBC($data)
{
    $key = getRandomBytes(16);
    $pad1 = getRandomBytes(rand(5, 10));
    $pad2 = getRandomBytes(rand(5, 10));
    if (rand(0, 1)) {
        return encryptAES128CBC("{$pad1}{$data}{$pad2}", $key, getRandomBytes(16));
    }
    return encryptAES128ECB("{$pad1}{$data}{$pad2}", $key);
}
function encryptedProfileFor($email, $key)
{
    return encryptAES128ECB(profileFor($email), $key);
}
{
    $blocks = str_split($data, 16);
    foreach ($blocks as &$block) {
        $block = _decryptAES128ECB($block, $key);
    }
    $plaintext = implode($blocks);
    try {
        return removePKCS7Padding($plaintext);
    } catch (Exception $e) {
        if ($strictPadding) {
            throw $e;
        }
        return $plaintext;
    }
}
// don't output if we're included into another script.
if (!debug_backtrace()) {
    $encrypted = base64_decode(file_get_contents('07-data.txt'));
    $key = 'YELLOW SUBMARINE';
    $decryptedSane = removePKCS7Padding(_decryptAES128ECB($encrypted, $key));
    $decrypted = decryptAES128ECB($encrypted, $key);
    print "Sanity check:\n";
    $sanity = $decryptedSane === $decrypted;
    print $sanity ? "Success!\n\n" : "Failure :(\n\n";
    print "Homebrew sanity check:\n";
    $test = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
    $sanity = decryptAES128ECB(encryptAES128ECB($test, $key), $key) === $test;
    print $sanity ? "Success!\n\n" : "Failure :(\n\n";
    print "Decrypted data:\n";
    print "{$decrypted}\n";
}