PHP Mesaj Şifreleme Fonksiyonu

Whatsapp Uçtan uca şifreli mesajlaşmanın çok konuşulduğu şu günlerde şifreli mesaj ihtiyaçlarınıza çözüm olabilecek bir yöntem paylaşmak istiyorum. Mesaj uygulamalarınızda, içerikleri veri tabanında şifreli olarak tutmak için aşağıdaki fonksiyonu kullanabilirsiniz. Veri tabanında tutacaksanız Veri tipini text olarak ayarlamakta fayda var

 
// Şifrelenecek mesaj
$mesaj= "Kod Günlüğüme Hoşgeldiniz"; 
 
// Mesajı görüntüleyelim
echo "Orjinal Mesaj: " . $mesaj; 
 
// Şifreleme metodu
$ciphering = "AES-128-CTR"; 
 
//  OpenSSl Encryption method kullanımı
$iv_length = openssl_cipher_iv_length($ciphering); 
$options = 0; 
 
// encryption yaparken kullanılacak numeric değer
$encryption_iv = '1234567891011121'; 
 
// encryption key 
$encryption_key = "KodGunlugum"; 
 
// openssl_encrypt() function kullanımı
$encryption = openssl_encrypt($mesaj, $ciphering, $encryption_key, $options, $encryption_iv); 
 
// encrypted şifreli gösterimi
echo "Şifreli Mesaj: " . $encryption . "\n"; 
 
// decryption yaparken kullanılacak numeric değer (encryption_iv ile aynı olmalıdır.)
$decryption_iv = '1234567891011121'; 
 
// decryption key  ($encryption_key ile aynı olmalıdır)
$decryption_key = "KodGunlugum"; 
 
// openssl_decrypt() function kullanımı
$decryption=openssl_decrypt ($encryption, $ciphering, $decryption_key, $options, $decryption_iv); 
 
// decrypted string (çözülmüş mesaj)
echo "Çözülmüş Mesaj: " . $decryption;
Bu İçeriğe Puan Verebilirsiniz
[Toplam: 18 Ortalama: 4.9]

Bir cevap yazın

E-posta hesabınız yayımlanmayacak.

This site uses Akismet to reduce spam. Learn how your comment data is processed.