function encrypt and decrypt use full

function encrypt($string) {
$output = false;
$encrypt_method = “AES-256-CBC”;
$secret_key = ‘fe67d68ee1e09b47acd8810b880d537034c10c15344433a992b9c79002666844’;
$secret_iv = ‘fdd3345455fffgffffhkkyoife67d68ee1e09b47acd8810b880d537034c10c15344433a992b9c79002666844’;

$key = hash(‘sha256’, $secret_key);
$iv = substr(hash(‘sha256’, $secret_iv), 0, 16);
$output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);
$output = base64_encode($output);
return $output;
}

function decrypt($string) {
$output = false;
$encrypt_method = “AES-256-CBC”;
$secret_key = ‘fe67d68ee1e09b47acd8810b880d537034c10c15344433a992b9c79002666844’;
$secret_iv = ‘fdd3345455fffgffffhkkyoife67d68ee1e09b47acd8810b880d537034c10c15344433a992b9c79002666844’;

$key = hash(‘sha256’, $secret_key);
$iv = substr(hash(‘sha256’, $secret_iv), 0, 16);
$output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv);
return $output;
}

Advertisements