GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   little php help (https://gfy.com/showthread.php?t=932940)

fris 10-12-2009 03:40 PM

little php help
 
Anyway to reverse this?

Code:

function hex2bin($data) {
    $len = strlen($data);
    return pack("H" . $len, $data);
}

function check_key($input){
    $iv = "qe3jigneqfrgnqw2egfmas4qetjkn5lg";
    $key = "589752d5b0f4217747bd721111be9057";
    $text = hex2bin($input);
    $domain = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
    echo $input. '<br/>' .$domain;
}


adultpro 10-12-2009 03:44 PM

What do you mean by reverse? Are you talking about an algorithmic reversal or the possibility of reverse engineering?

For an algorithmic reversal, the reverse would be taking the output contained in $domain, running it through mcrypt_encrypt() using the same key, IV, and mode, then running the output from that through a bin2hex function.

As for reverse engineering, you have no worries about anything provided your key and IV are secure.

quantum-x 10-12-2009 04:11 PM

PHP Code:

<?

function hex2bin($data) {
     $len = strlen($data);
     return pack("H" . $len, $data); 


function bin2hex2($data) {
     return unpack("H*",$data);
}

function check_key($input){
    $iv = "qe3jigneqfrgnqw2egfmas4qetjkn5lg";
    $key = "589752d5b0f4217747bd721111be9057"; 
    $text = hex2bin($input);
    $domain = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
    return $domain;
}

function make_key($input)    {
    $iv = "qe3jigneqfrgnqw2egfmas4qetjkn5lg";
    $key = "589752d5b0f4217747bd721111be9057"; 
    $domain = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $input, MCRYPT_MODE_ECB, $iv);
    $key = bin2hex2($domain);
    return $key[1];
}


$key = make_key($_REQUEST['domain']);
echo "Key is ".$key."<br /><br />\n\n";
echo "Decode Check: ".check_key($key);


?>

page.php?domain=test.com


All times are GMT -7. The time now is 05:04 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123