|
|
#1 (permalink) |
|
Üyelik Tarihi: 09.11.2006
Yer: izmir
Mesaj: 194
|
PHP de cryptolama
merhaba arkadaslar. PHP de bildiginiz gibi md5() ile veya password() ile tek yönlü cryptolama yapabiliyoruz. Ben iki yönlü crypto arıyordum. Böyle birşey denedim ama çalışmadı.
HTML Code:
<? function encryptData($value){
$key = "top secret key";
$text = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$crypttext = mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $text, MCRYPT_MODE_ECB, $iv);
return $crypttext;
}
function decryptData($value){
$key = "top secret key";
$crypttext = $value;
$iv_size = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256, MCRYPT_MODE_ECB);
$iv = mcrypt_create_iv($iv_size, MCRYPT_RAND);
$decrypttext = mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, $crypttext, MCRYPT_MODE_ECB, $iv);
return trim($decrypttext);
}
echo encryptData("magos");
?>
|
|
|
|
|
|
#6 (permalink) |
|
Üyelik Tarihi: 16.12.2006
Yer: istanbul
Yaş: 26
Mesaj: 464
|
Re: PHP de cryptolama
Mesajın içinde yazıyo ya... 2 fonksiyon; biri encode biri decode.
Alternatif olarak uuencode ve uudecode var ama bu method a-z ve 0-9 karakterleri haricinde karakter üretiyor ve url tarzı şeylere ekleyeceksen problem yaratıyor.
__________________
imzaya sponsor Mesaj s5prin tarafından 27.03.2007 (12:30) yeniden düzenlendi.. |
|
|
|
Zoque'a hoşgeldiniz!