Thursday, September 28, 2023

Encrypt Decrypt PHP OPEN SSL PHP

 <?php
 
$simple_string = "Welcome to Jungles\n";
 
echo " Text Asli : " . $simple_string;
 
$ciphering = "AES-128-CTR";
 
$iv_length = openssl_cipher_iv_length($ciphering);
$options = 0;
 
$encryption_iv = '1234567891011121';
 
$encryption_key = "Test!234";
 
$encryption = openssl_encrypt($simple_string, $ciphering,
            $encryption_key, $options, $encryption_iv);
 
echo " 1. Encrypted String: " . $encryption . "\n";
 
$decryption_iv = '1234567891011121';
 
$decryption_key = "Test!234";
 
$decryption=openssl_decrypt ($encryption, $ciphering,
        $decryption_key, $options, $decryption_iv);
 
echo " 2. Decrypted String: " . $decryption;
 
?>

No comments:

Post a Comment

Set Cookie dan Remove Cookie dengan php vanilla.js

< html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport...