Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php $key = "1444264100442707515065929641401042523324"; $ivHashCiphertext = "XUvL..

Decoded Output download

<?php 
 
 
 
$key = "1444264100442707515065929641401042523324"; 
$ivHashCiphertext = "XUvLCz5dM7WmYVOHMa4sX/fWB/zcS8bc7KJoIgwPKE/Pj89sK91Pb5otI5b7G2uknY8ESQLqaOKruboKyCbib8naDSUd2c2UYsIkpHwLaY+lARtsqUNa2fAcEP5LBaoH"; 
 
function encrypt($plaintext, $password) { 
    $method = "AES-256-CBC"; 
    $key = hash('sha256', $password, true); 
    $iv = openssl_random_pseudo_bytes(16); 
 
    $ciphertext = openssl_encrypt($plaintext, $method, $key, OPENSSL_RAW_DATA, $iv); 
    $hash = hash_hmac('sha256', $ciphertext, $key, true); 
 
    return base64_encode($iv . $hash . $ciphertext); 
} 
// --------------------------------------------------------------------- 
 
function decrypt($ivHashCiphertext, $password, $ignore_error = false) { 
    $data = base64_decode($ivHashCiphertext, TRUE); 
    if ($data === FALSE) { 
        die("Unable to understand data"); 
    } 
    $method = "AES-256-CBC"; 
    $iv = substr($data, 0, 16); 
    $hash = substr($data, 16, 32); 
    $ciphertext = substr($data, 48); 
    $key = hash('sha256', $password, true); 
 
    if (hash_hmac('sha256', $ciphertext, $key, true) !== $hash) { 
      if ($ignore_error) { 
        return ""; 
      } else { 
        die("Unable to decrypt
"); 
      } 
    } 
 
    return openssl_decrypt($ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv); 
} 
$result = decrypt($ivHashCiphertext, $key); 
 
// Output the decrypted result 
echo $result; ?>

Did this file decode correctly?

Original Code

<?php



$key = "1444264100442707515065929641401042523324";
$ivHashCiphertext = "XUvLCz5dM7WmYVOHMa4sX/fWB/zcS8bc7KJoIgwPKE/Pj89sK91Pb5otI5b7G2uknY8ESQLqaOKruboKyCbib8naDSUd2c2UYsIkpHwLaY+lARtsqUNa2fAcEP5LBaoH";

function encrypt($plaintext, $password) {
    $method = "AES-256-CBC";
    $key = hash('sha256', $password, true);
    $iv = openssl_random_pseudo_bytes(16);

    $ciphertext = openssl_encrypt($plaintext, $method, $key, OPENSSL_RAW_DATA, $iv);
    $hash = hash_hmac('sha256', $ciphertext, $key, true);

    return base64_encode($iv . $hash . $ciphertext);
}
// ---------------------------------------------------------------------

function decrypt($ivHashCiphertext, $password, $ignore_error = false) {
    $data = base64_decode($ivHashCiphertext, TRUE);
    if ($data === FALSE) {
        die("Unable to understand data");
    }
    $method = "AES-256-CBC";
    $iv = substr($data, 0, 16);
    $hash = substr($data, 16, 32);
    $ciphertext = substr($data, 48);
    $key = hash('sha256', $password, true);

    if (hash_hmac('sha256', $ciphertext, $key, true) !== $hash) {
      if ($ignore_error) {
        return "";
      } else {
        die("Unable to decrypt\n");
      }
    }

    return openssl_decrypt($ciphertext, $method, $key, OPENSSL_RAW_DATA, $iv);
}
$result = decrypt($ivHashCiphertext, $key);

// Output the decrypted result
echo $result;

Function Calls

decrypt 1

Variables

$key 1444264100442707515065929641401042523324
$password 1444264100442707515065929641401042523324
$ignore_error None
$ivHashCiphertext XUvLCz5dM7WmYVOHMa4sX/fWB/zcS8bc7KJoIgwPKE/Pj89sK91Pb5otI5b7..

Stats

MD5 c8b4d7bab393ca08b19bffdbedc2fde7
Eval Count 0
Decode Time 52 ms