repl.it
@tml/

InsidiousProfuseWireframe

PHP (Legacy)

No description

fork
loading
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function evp_bytes_to_key($data, $salt) {
    $data .= $salt;
    $fkey = $key = hash('md5', $data, true);
    while(strlen($fkey) < 48) {
        $key = hash('md5', $key.$data, true);
        $fkey .= $key;
    }
    return substr($fkey, 0, 48);
}

function decrypt($input, $key) {
    $crypttext= base64_decode($input);
    $salt = substr($crypttext, 8, 8);
    $evp = evp_bytes_to_key($key, $salt);
    $derived_key = substr($evp, 0, 32);
    $iv = substr($evp, 32);
    return openssl_decrypt(substr($crypttext, 16), 'aes-256-cbc', $derived_key, OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING, $iv);
}

$encrypted = 'U2FsdGVkX1+NywCLW1AokjLtGz4fnUi4UtaJVRN5hZY=';
$key = '12345';
var_dump(trim(decrypt($encrypted, $key)));
PHP 7.0.8 (Legacy: use the following for new features: Command-line PHP: https://repl.it/languages/php_cli PHP Web Server: https://repl.it/languages/php7