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 function hexToHumanReadableTime($hex) { // The first 8 characters are the seco..
Decoded Output download
<?php
function hexToHumanReadableTime($hex) {
// The first 8 characters are the seconds part (32 bits)
// The remaining characters are the microseconds part
$secondsHex = substr($hex, 0, 8);
$microsecondsHex = substr($hex, 8);
// Convert hex to decimal
$seconds = hexdec($secondsHex);
$microseconds = hexdec($microsecondsHex);
// Create a DateTime object from the seconds
$dateTime = new DateTime("@$seconds");
$dateTime->setTimezone(new DateTimeZone('UTC')); // Set the timezone if necessary
// Format the time as H:i:s.u
$formattedTime = $dateTime->format("H:i:s") . '.' . $microseconds;
return $formattedTime;
}
// The unique ID to decode
$uniqueId = '666ed90b1e2cd';
// Decode the unique ID
$decodedTime = hexToHumanReadableTime($uniqueId);
// Print the decoded time
echo "Decoded Time: " . $decodedTime . "
";
?>
Did this file decode correctly?
Original Code
<?php
function hexToHumanReadableTime($hex) {
// The first 8 characters are the seconds part (32 bits)
// The remaining characters are the microseconds part
$secondsHex = substr($hex, 0, 8);
$microsecondsHex = substr($hex, 8);
// Convert hex to decimal
$seconds = hexdec($secondsHex);
$microseconds = hexdec($microsecondsHex);
// Create a DateTime object from the seconds
$dateTime = new DateTime("@$seconds");
$dateTime->setTimezone(new DateTimeZone('UTC')); // Set the timezone if necessary
// Format the time as H:i:s.u
$formattedTime = $dateTime->format("H:i:s") . '.' . $microseconds;
return $formattedTime;
}
// The unique ID to decode
$uniqueId = '666ed90b1e2cd';
// Decode the unique ID
$decodedTime = hexToHumanReadableTime($uniqueId);
// Print the decoded time
echo "Decoded Time: " . $decodedTime . "\n";
?>
Function Calls
hexdec | 2 |
substr | 2 |
hexToHumanReadableTime | 1 |
Stats
MD5 | f6d43eaae6fe46f01e833b8b4193cee0 |
Eval Count | 0 |
Decode Time | 83 ms |