1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
function crypter($url){
$algo = "gost";
$mode = "cfb";
$key_size = mcrypt_module_get_algo_key_size($algo);
$iv_size = mcrypt_get_iv_size($algo, $mode);
$iv = "aluteret";
$cle = "my key";
$cle = substr($cle, 0, $key_size);
$texte = rawurldecode($url);
return(rawurlencode(mcrypt_encrypt($algo, $cle, $texte, $mode, $iv)));
}
function decrypter($url){
$algo = "gost";
$mode = "cfb";
// calcul des longueurs max de la clé et de l'IV
$key_size = mcrypt_module_get_algo_key_size($algo);
$iv_size = mcrypt_get_iv_size($algo, $mode);
$iv = "aluteret";
$cle = "my key";
$cle = substr($cle, 0, $key_size);
$crypte = rawurldecode($url);
return (mcrypt_decrypt($algo, $cle, $crypte, $mode, $iv));
} |
Partager