email - Xor Encryption PHP for Activationlink E-Mail -
i have problem xor encryption activiationlink. xor encryption activiationlink code works, encryption last id user. if im testing mail, produced curious encryption "30303030"
example id: 3445 if encryption have 54515c50
but if click on activationlink in e-mail have "30303030" , not 54515c50.
i don't know how creat encryption "30303030". testing id , have again "30303030" encryption
i don't have idea solve this.
here code:
<?php // xor "encryption" function x0rcrypt($text, $key) { if (strlen($schluessel) == 0) { return; } $result = ''; $i = 0; while ($i < strlen($text)) { ($j=0; $j < strlen($key); $j++) { if ($i >= strlen($text)) { break; } // text xor key $result .= $text{$i} ^ $key{$j}; $i++; } } return($result); } // hex bin function hex2bin($string) { return pack('h*', $string); } // encryption, return hex function x0rencrypt($text, $key) { return bin2hex(x0rcrypt($text, $key)); } // decode, enter hex function x0rdecrypt($text, $schluessel) { return x0rcrypt(hex2bin($text), $schluessel); } // example code: $text = 'blah blubb'; $key = 'geheimesganzlangesultrakompliziertespasswort'; // encryption #$text_encrypted = x0rencrypt($text, $key); // decode #$text_decrypted = x0rdecrypt($text_encrypted, $key); ?>
an here activationlink mail:
$activlink="<a href=\"http://" . $_server['server_name'] ."/release/".rex_geturl('82','0', array('mode'=>x0rencrypt($db->last_insert_id, $key)), '&'). "\">activation account</a>";
Comments
Post a Comment