Mudah Encrypt dan Decrypt Dengan PHP Dua Arah
<?php // Encrypt Function function encrypt($plainText, $key) { $secretKey = md5($key); $iv = substr( hash( 'sha256', "aaaabbbbcccccddddeweee" ), 0, 16 ); $encryptedText = openssl_encrypt($plainText, 'AES-128-CBC', $secretKey, OPENSSL_RAW_DATA, $iv); return base64_encode($encryptedText); } //Decrypt Function function decrypt($encryptedText, $key) { $key = md5($key); $iv = substr( hash( 'sha256', "aaaabbbbcccccddddeweee" ), 0, 16 ); $decryptedText = openssl_decrypt(base64_decode($encryptedText), 'AES-128-CBC', $key, OPENSSL_RAW_DATA, $iv); return $decryptedText; } // Encrypt data using this function echo encrypt("Vikash Kumar Singh","MYKEY"); // Decrypt data using this function echo decrypt("sFhoDYtPj1samXYten1VcrwLdv3uzQt7VDvjTBJgZkQ=","MYKEY"); ?>
Lanjut Part : 1
Jam : 14:45:21
Durasi Part : 0:0:1
Durasi Total : 0:0:1
Punya Pertanyaan , Silahkan Whatsapp Langsung
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1