- rtrim: documentation ( source)
- base64_decode: documentation ( source)
- base64_encode: documentation ( source)
- md5: documentation ( source)
<?php
$key = "sfjdo89ejasfj3oh9w3jipmowf984lkfq32jljlk3famkladf";
$string = "pd[land]=at&pd[plz]=9020&pd[geburtsjahr]=1980&pdIdent[skilineId]=123456789&pdFree[skiGebiet]=Nassfeld";
$md5Key = md5($key);
$encrypted = base64_encode(mcrypt_encrypt(MCRYPT_3DES, $md5Key), $string, MCRYPT_MODE_CBC, md5($md5Key));
echo $encrypted;
$decrypted = rtrim(mcrypt_decrypt(MCRYPT_3DES, $md5Key, base64_decode($encrypted), MCRYPT_MODE_CBC, md5($md5Key)), "\0");
echo $decrypted;