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 // This is a D5 geekdom cache so expect some work to be done to get the coodinate..
Decoded Output download
<?php
// This is a D5 geekdom cache so expect some work to be done to get the coodinates
$encryption_key = base64_encode("it's a geekdom geocaching puzzle");
// some generic open ssl code to encrypt
function doEncrypt($data, $key) {
$encryption_key = base64_decode($key);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
// some generic open ssl code to decrypt
function doDecrypt($data, $key) {
$encryption_key = base64_decode($key);
list($encrypted_data, $iv) = explode('::', base64_decode($data), 2);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);
}
// the cache is not at this place.
$coordinates = "It's not here: N51 26.968 W001 15.244 ";
//echo "$coordinates
";
// encrypt the data
$coords_enc = doEncrypt($coordinates, $encryption_key);
//echo "Encrypted: $coords_enc
";
$coords_enc = "ZUdjQmd1MHY4WTR1dC9UY0RPL00wT1gzS3RnTDVxbm93MnBVbUg".
"wWHkvWXEwYlZEdFJtTGVWb3E0eHRxYVZsYjo6Fa1cwTqiStqsoL6uQSFTYw==";
//decrypt the data to give the real final location
$coords_dec = doDecrypt($coords_enc, $encryption_key);
echo "Final: $coords_dec
";
//TFTC
?>
Did this file decode correctly?
Original Code
<?php
// This is a D5 geekdom cache so expect some work to be done to get the coodinates
$encryption_key = base64_encode("it's a geekdom geocaching puzzle");
// some generic open ssl code to encrypt
function doEncrypt($data, $key) {
$encryption_key = base64_decode($key);
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-256-cbc'));
$encrypted = openssl_encrypt($data, 'aes-256-cbc', $encryption_key, 0, $iv);
return base64_encode($encrypted . '::' . $iv);
}
// some generic open ssl code to decrypt
function doDecrypt($data, $key) {
$encryption_key = base64_decode($key);
list($encrypted_data, $iv) = explode('::', base64_decode($data), 2);
return openssl_decrypt($encrypted_data, 'aes-256-cbc', $encryption_key, 0, $iv);
}
// the cache is not at this place.
$coordinates = "It's not here: N51 26.968 W001 15.244 ";
//echo "$coordinates\n";
// encrypt the data
$coords_enc = doEncrypt($coordinates, $encryption_key);
//echo "Encrypted: $coords_enc\n";
$coords_enc = "ZUdjQmd1MHY4WTR1dC9UY0RPL00wT1gzS3RnTDVxbm93MnBVbUg".
"wWHkvWXEwYlZEdFJtTGVWb3E0eHRxYVZsYjo6Fa1cwTqiStqsoL6uQSFTYw==";
//decrypt the data to give the real final location
$coords_dec = doDecrypt($coords_enc, $encryption_key);
echo "Final: $coords_dec \n";
//TFTC
Function Calls
base64_encode | 1 |
Stats
MD5 | bd77a2bc5377c7ba5981ffb0ae38da34 |
Eval Count | 0 |
Decode Time | 99 ms |