<?php
require_once("./Cipher.php");
$cipher = new Cipher;
if (!isset($_COOKIE['c_data'])) {
$data = $cipher->encrypt("some data", "a key");
$iv = $cipher->getIV();
setcookie("c_data", $data, time()+3600);
setcookie("c_iv", $iv, time()+3600);
} else {
$iv = $_COOKIE['c_iv'];
$data = $_COOKIE['c_data'];
echo $cipher->decrypt($data, "a key", $iv);
}
?>
|