i have a Problem with my Xor Encryption Activiationlink. The Xor Encryption Activiationlink Code works, they encryption the last ID from User. But if im testing by the Mail, it produced curious Encryption "30303030"
Example ID: 3445 if the encryption so we have this 54515c50
But if i click on the Activationlink in the E-Mail i have "30303030" and not 54515c50.
I don't know how to creat this Encryption "30303030". I testing with another id and i have again the "30303030" Encryption
I don't have any idea to solve this.
Here my Code:
<?php
// XOR "Encryption"
function x0rcrypt($text, $key) {
if (strlen($schluessel) == 0) {
return;
}
$result = '';
$i = 0;
while ($i < strlen($text)) {
for ($j=0; $j < strlen($key); $j++) {
if ($i >= strlen($text)) {
break;
}
// Text XOR Key
$result .= $text{$i} ^ $key{$j};
$i++;
}
}
return($result);
}
// Hex to 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 my Activationlink for the Mail:
$activlink="<a href=\"http://" . $_SERVER['SERVER_NAME'] ."/release/".rex_getUrl('82','0', array('mode'=>x0rencrypt($db->last_insert_id, $key)), '&'). "\">Activation your Account</a>";