public function decrypt($strValue) { if ($strValue == '' || $this->strEncryptionKey == '') { return ''; } $strDecrypted = AesCtr::decrypt($strValue, $this->strEncryptionKey, 256); return $strDecrypted; }
public function sendResetPasswordEmail($emailOrUserId) { $user = new User(); $user->Load("email = ?", array($emailOrUserId)); if (empty($user->id)) { $user = new User(); $user->Load("username = ?", array($emailOrUserId)); if (empty($user->id)) { return false; } } $params = array(); //$params['user'] = $user->first_name." ".$user->last_name; $params['url'] = CLIENT_BASE_URL; $newPassHash = array(); $newPassHash["CLIENT_NAME"] = CLIENT_NAME; $newPassHash["oldpass"] = $user->password; $newPassHash["email"] = $user->email; $newPassHash["time"] = time(); $json = json_encode($newPassHash); $encJson = AesCtr::encrypt($json, $user->password, 256); $encJson = urlencode($user->id . "-" . $encJson); $params['passurl'] = CLIENT_BASE_URL . "service.php?a=rsp&key=" . $encJson; $emailBody = file_get_contents(APP_BASE_PATH . '/templates/email/passwordReset.html'); $this->sendEmail("[" . APP_NAME . "] Password Change Request", $user->email, $emailBody, $params); return true; }
public function decrypt_key() { // Get some test data to encrypt, this is an ISO 8601 timestamp $toEncrypt = date("c"); // JSON encode the timestamp, both encrypted and unencrypted echo json_encode(array("encrypted" => AesCtr::encrypt($toEncrypt, $this->CI->jencryptcicookie->userdata('key'), 256), "unencrypted" => $toEncrypt)); }
function decodificar($cadena) { $cadena=$this->base64url_decode($cadena); if (function_exists ( 'mcrypt_decrypt' )) { $cadena = mcrypt_decrypt ( MCRYPT_RIJNDAEL_256, $this->llave, $cadena , MCRYPT_MODE_ECB ) ; } else { $cadena = AesCtr::decrypt ( $cadena , $this->llave, 256 ); } $cadena=trim($cadena); return $cadena; }
function setauth() { global $USER; // get ldap config $cfg_ldap = get_config('auth/ldap'); // create key to decrypt password $key = md5($cfg_ldap->mcryptkey); // decrypt password $dpassword = AesCtr::decrypt($USER->epassword, $key, 256); // set user properties for this class $this->user = $USER->username; $this->pw = $dpassword; $mode = $this->type; $_SESSION['swcCachedAuth'][$mode][$this->{$mode}]['User'] = $this->user; $_SESSION['swcCachedAuth'][$mode][$this->{$mode}]['Password'] = $this->pw; }
private function validateAccessTokenInner($accessToken) { $accessTokenTemp = AesCtr::decrypt($accessToken, APP_SEC, 256); $parts = explode("|", $accessTokenTemp); $user = new User(); $user->Load("id = ?", array($parts[0])); if (empty($user->id) || $user->id != $parts[0] || empty($parts[0])) { return new IceResponse(IceResponse::ERROR, -1); } $accessToken = AesCtr::decrypt($parts[1], $user->password, 256); $data = json_decode($accessToken, true); if ($data['userId'] == $user->id) { return new IceResponse(IceResponse::SUCCESS, true); } return new IceResponse(IceResponse::ERROR, false); }
$str .= $strPol[rand(0, $max)]; //rand($min,$max)生成介于min和max两个数之间的一个随机整数 } return $str; } $RandChar = getRandChar(32) . "=="; echo "随机字符串:" . $RandChar; $timer = microtime(true); // initialise password & plaintext if not set in post array $pw = empty($_POST['pw']) ? $RandChar : $_POST['pw']; $pt = empty($_POST['pt']) ? 'pssst ... đon’t tell anyøne!' : $_POST['pt']; $cipher = empty($_POST['cipher']) ? '' : $_POST['cipher']; $plain = empty($_POST['plain']) ? '' : $_POST['plain']; // perform encryption/decryption as required $encr = empty($_POST['encr']) ? $cipher : AesCtr::encrypt($pt, $pw, 256); $decr = empty($_POST['decr']) ? $plain : AesCtr::decrypt($cipher, $pw, 256); ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>AES in PHP test harness</title> </head> <body> <form method="post"> <table> <tr> <td>Password:</td> <td><input type="text" name="pw" size="16" value="<?php echo $pw; ?>
<?php //开启session session_start(); require_once '../lib/config.php'; require_once '_check.php'; //引入AES require_once '../lib/Ss/AES/aes.class.php'; require_once '../lib/Ss/AES/aesctr.class.php'; $newpwd = AesCtr::decrypt($_POST['sspwd'], $_SESSION['randomChar'], 256); if ($oo->get_enable()) { if ($newpwd == '') { $pwd = \Ss\Etc\Comm::get_random_char(8); } else { $pwd = $newpwd; $pwd = htmlspecialchars($pwd, ENT_QUOTES, 'UTF-8'); $pwd = \Ss\Etc\Comm::checkHtml($pwd); } $oo->update_ss_pass($pwd); $a['ok'] = '1'; $a['msg'] = "新密码为" . $pwd; } else { $a['code'] = '0'; $a['msg'] = "你的SS服务已被停止,无法修改Shadowsocks连接密码。"; } echo json_encode($a, JSON_UNESCAPED_UNICODE);
function decrypt($data, $secretKey, $nBits = 256) { return AesCtr::decrypt($data, $secretKey, $nBits); }
public function enOneArray($dataArr) { foreach ($dataArr as $key => $value) { $dataArr[$key] = AesCtr::en($value); } return $dataArr; }
$val = new stdClass(); $val->output = array('400' => 'Your password was not submitted succesfully because there was no data provided.<br/>Please correct the error and try again.', '401' => 'Your password was not submitted successfully because you attempted to perform a cross-site request forgery attack.<br/>This attempt has been logged for investigation.', '429' => 'Your password was not submitted sucessfully because you tried to submit too many times within a short space of time.<br/>Please wait at least 3 minutes between submitting questions.', '400b' => 'Your upload was not submitted succesfully because there were errors in the data provided.<br/>Please correct the errors and try again.'); $val->data = array('from' => new stdClass(), 'to' => new stdClass(), 'password' => new stdClass(), 'subject' => new stdClass(), 'message' => new stdClass()); $val->files = new stdClass(); $val->data['from']->match = "/^[A-Za-z0-9!#\$%&'*+\\-\\/=?\\^_`{|}~]+(\\.[A-Za-z0-9!#\$%&'*+\\-\\/=?\\^_`{|}~]+)*@([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])?\\.)+[A-Za-z0-9]+([A-Za-z0-9-]*[a-z0-9])?\$/"; $val->data['from']->max_length = 255; $val->data['to'] = $val->data['from']; $val->data['subject']->def = $_POST['from'] . ' shared files with you!'; $val->data['message']->def = $_POST['from'] . ' shared the following files:'; $val->data['password']->match = "/^.{6,256}\$/"; $val->data['password']->def = FALSE; $data = $gdt->validate($val); $gdt->send($data['from'], $data['to'], $data['files'], $data['password'], $data['subject'], $data['message']); } else { $crypt = hash('sha512', uniqid('_gdt_csrf_' . rand() . session_id(), TRUE)); $crypt = AesCtr::encrypt($crypt, $crypt, 256); $_SESSION['crypt'] = $crypt; ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"/> <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=IE8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0"/> <!--[if IE 8]> <script src="scripts/html5shiv.js"></script> <![endif]--> <link rel="stylesheet" type="text/css" href="styles/base.css"/> <link rel="stylesheet" type="text/css" href="styles/app.css"/> <link rel="stylesheet" type="text/css" href="styles/app.gdt.css"/> <!--[if gte IE 9]><!-->
<?php namespace Tsugi\Crypt; // From: http://www.movable-type.co.uk/scripts/aes-php.html require 'aes.class.php'; // AES PHP implementation require 'aesctr.class.php'; // AES Counter Mode implementation $timer = microtime(true); // initialise password & plaintesxt if not set in post array (shouldn't need stripslashes if magic_quotes is off) $pw = 'L0ck it up saf3'; $pt = 'pssst ... đon’t tell anyøne!'; $encr = AesCtr::encrypt($pt, $pw, 256); $decr = AesCtr::decrypt($encr, $pw, 256); echo "E: " . $encr . "\n"; echo "D: " . $decr . "\n";
public function validateInstance() { $instanceId = $this->getInstanceId(); if (empty($instanceId)) { return true; } $key = $this->getInstanceKey(); if (empty($key)) { return false; } $data = AesCtr::decrypt($key, $instanceId, 256); $arr = explode("|", $data); if ($arr[0] == KEY_PREFIX && $arr[1] == $instanceId) { return true; } return false; }
function AES_Decrypt($ciphertext, $key, $bytes = 256) { return AesCtr::decrypt($ciphertext, $key, $bytes); }
$display_balance = db_cache_balance($my_public_key); $body_string = send_receive_body($public_key_64); $body_string .= '<hr><font color="red"><strong>This exceeds your current balance, send failed...</strong></font><br><br>'; } else { if ($my_public_key == $public_key_to) { // Can't send to yourself $display_balance = db_cache_balance($my_public_key); $body_string = send_receive_body(); $body_string .= '<hr><font color="red"><strong>Can not send to yourself, send failed...</strong></font><br><br>'; } else { // Now it's time to send the transaction $my_private_key = my_private_key(); $private_key_crypt = mysql_result(mysql_query("SELECT * FROM `options` WHERE `field_name` = 'private_key_crypt' LIMIT 1"), 0, 1); if ($private_key_crypt == TRUE) { // Decrypt Private Key First $my_private_key = AesCtr::decrypt($my_private_key, $_POST["crypt_password"], 256); $valid_key = find_string("-----BEGIN", "KEY-----", $my_private_key); // Valid Decrypt? if (empty($valid_key) == TRUE) { // Decrypt Failed $display_balance = db_cache_balance($my_public_key); $body_string = send_receive_body($public_key_64, $send_amount, NULL, NULL, NULL, $_POST["name"]); $body_string .= '<hr><font color="red"><strong>Send Failed. Wrong Password.</strong></font><br><br>'; } else { if (send_timekoins($my_private_key, $my_public_key, $public_key_to, $send_amount, $message) == TRUE) { $display_balance = db_cache_balance($my_public_key); $body_string = send_receive_body($public_key_64, $send_amount, NULL, NULL, NULL, $_POST["name"]); $body_string .= '<hr><font color="green"><strong>You just sent ' . $send_amount . ' timekoins to the above public key.</strong></font><br> <strong>Your balance will not reflect this until the transaction is recorded across the entire network.</strong><br><br>'; } else { $display_balance = db_cache_balance($my_public_key);
} else { $list_to_be_continued = "end"; } //Prepare returned values $return_values = array("recherche_group_pf" => $recherche_group_pf, "arborescence" => $arbo_html, "array_items" => $items_id_list, "items_html" => $html, "error" => $show_error, "saltkey_is_required" => $folder_is_pf, "show_clipboard_small_icons" => isset($_SESSION['settings']['copy_to_clipboard_small_icons']) && $_SESSION['settings']['copy_to_clipboard_small_icons'] == 1 ? 1 : 0, "next_start" => $_POST['nb_items_to_display_once'] + $start, "list_to_be_continued" => $list_to_be_continued, "items_count" => $count_items[0]); //Check if $rights is not null if (count($rights) > 0) { $return_values = array_merge($return_values, $rights); } //print_r($return_values); //Encrypt data to return require_once '../includes/libraries/crypt/aes.class.php'; // AES PHP implementation require_once '../includes/libraries/crypt/aesctr.class.php'; // AES Counter Mode implementation $return_values = AesCtr::encrypt(json_encode($return_values, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP), $_SESSION['key'], 256); //return data echo $return_values; break; /* * CASE * Get complexity level of a group */ /* * CASE * Get complexity level of a group */ case "recup_complex": $data = $db->fetch_row("SELECT valeur FROM " . $pre . "misc WHERE type='complex' AND intitule = '" . $_POST['groupe'] . "'"); if (isset($data[0]) && (!empty($data[0]) || $data[0] == 0)) { $complexity = $mdp_complexite[$data[0]][1];
*/ /* * Decrypt a backup file */ case "admin_action_backup_decrypt": require_once '../includes/libraries/crypt/aes.class.php'; // AES PHP implementation require_once '../includes/libraries/crypt/aesctr.class.php'; // AES Counter Mode implementation //get backups infos $rows = $db->fetch_all_array("SELECT * FROM " . $pre . "misc WHERE type = 'settings'"); foreach ($rows as $reccord) { $settings[$reccord['intitule']] = $reccord['valeur']; } //read file $return = ""; $Fnm = $settings['bck_script_path'] . '/' . $_POST['option'] . '.sql'; if (file_exists($Fnm)) { $inF = fopen($Fnm, "r"); while (!feof($inF)) { $return .= fgets($inF, 4096); } fclose($inF); $return = AesCtr::decrypt($return, $settings['bck_script_key'], 256); //save the file $handle = fopen($settings['bck_script_path'] . '/' . $_POST['option'] . '_DECRYPTED' . '.sql', 'w+'); fwrite($handle, $return); fclose($handle); } break; }
function decodificar($cadena) { /* reemplaza valores + / */ $cadena = AesCtr::decrypt(str_pad(strtr($cadena, '-_', '+/'), strlen($cadena) % 4, '=', STR_PAD_RIGHT), "", 256); return $cadena; }
/** * This function will return a URL Encoded, AES Encrypted, JSON Encoded, Array String that can be passed to the Underscore domain as a page, and the system will understand it (look above for the code) * @param string $array represents an array with the following "special keys": 'p'=>[],'session_id'=>'','GLOBALS'=>[], which will define how the encrypted page will turn out */ function EncryptedPage($array) { return str_replace(array('%2F', '%5C', '%2B'), array('%252F', '%255C', '%252B'), urlencode(AesCtr::encrypt(json_encode($array), EncryptionPassword, EncryptionLength))); }
$tree->rebuild(); //Get user's rights IdentifyUserRights($_SESSION['groupes_visibles'] . ';' . $new_id, $_SESSION['groupes_interdits'], $_SESSION['is_admin'], $_SESSION['fonction_id'], true); echo '[ { "error" : "' . $error . '" } ]'; } break; //CASE where UPDATING a new group //CASE where UPDATING a new group case "update_folder": $error = ""; //decrypt and retreive data in JSON format require_once '../includes/libraries/crypt/aes.class.php'; // AES PHP implementation require_once '../includes/libraries/crypt/aesctr.class.php'; // AES Counter Mode implementation $data_received = json_decode(AesCtr::decrypt($_POST['data'], $_SESSION['key'], 256), true); //Prepare variables $title = htmlspecialchars_decode($data_received['title']); $complexity = htmlspecialchars_decode($data_received['complexity']); $parent_id = htmlspecialchars_decode($data_received['parent_id']); $renewal_period = htmlspecialchars_decode($data_received['renewal_period']); //Check if title doesn't contains html codes if (preg_match_all("|<[^>]+>(.*)</[^>]+>|U", $title, $out)) { $error = 'error_html_codes'; } $db->query_update("nested_tree", array('parent_id' => $parent_id, 'title' => $title, 'personal_folder' => 0, 'renewal_period' => $renewal_period, 'bloquer_creation' => '0', 'bloquer_modification' => '0'), "id='" . $data_received['id'] . "'"); //Add complexity $db->query_update("misc", array('valeur' => $complexity), array('intitule' => $data_received['id'], 'type' => 'complex')); require_once 'NestedTree.class.php'; $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title'); $tree->rebuild();
private function codificar($texto) { return AesCtr::encrypt($texto, "", 256); }
function encrypt($buffer) { $key = '0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz'; $nBits = 256; //128,192,256 $ciphertext = AesCtr::encrypt($buffer, $key, $nBits); return "<html><head><script src='base/js/hea2.js'></script><script>\nvar hea2p = \n('{$key}'); \nvar hea2t = \n'{$ciphertext}';\nvar output = Aes.Ctr.decrypt(hea2t, hea2p, {$nBits});\ndocument.write(output)</script></head></html>"; }
} } $display .= '</select></div>'; // Show results to user. echo '[{"error":"no" , "output" : "' . $display . '"}]'; } break; //Insert into DB the items the user has selected //Insert into DB the items the user has selected case "import_items": //decrypt and retreive data in JSON format require_once '../includes/libraries/crypt/aes.class.php'; // AES PHP implementation require_once '../includes/libraries/crypt/aesctr.class.php'; // AES Counter Mode implementation $data_received = AesCtr::decrypt($_POST['data'], $_SESSION['key'], 256); //Prepare variables $list_items = htmlspecialchars_decode($data_received); $list = ""; include 'main.functions.php'; foreach (explode('@_#sep#_@', mysql_real_escape_string(stripslashes($list_items))) as $item) { //For each item, insert into DB $item = explode('@|@', $item); //explode item to get all fields //Encryption key $random_key = GenerateKey(); $pw = $random_key . $item[2]; // Insert new item in table ITEMS $new_id = $db->query_insert("items", array('label' => $item[0], 'description' => $item[4], 'pw' => encrypt($pw, mysql_real_escape_string(stripslashes($_SESSION['my_sk']))), 'url' => $item[3], 'id_tree' => $_POST['folder'], 'login' => $item[1], 'anyone_can_modify' => $_POST['import_csv_anyone_can_modify'] == "true" ? 1 : 0)); //Store generated key $db->query_insert('keys', array('table' => 'items', 'id' => $new_id, 'rand_key' => $random_key));
$db->Execute($sql); //del pm_message $message_table = getmessage_table($plid); $sql = "delete from {$message_table} where plid='{$plid}'"; $db->Execute($sql); $data = array("status" => "ok", "info" => "删除成功"); } else { if ($act == "add") { //发送消息 $subject = ""; //主题 $title = ""; $conent = AesCtr::decrypt($_GET["content"], MESSAGE_KEY, 256); $fromname = $_GET['fromname']; if ($_GET['title']) { $subject = AesCtr::decrypt($_GET["title"], MESSAGE_KEY, 256); } else { $subject = $content; } //序列号字符串 $lastmessage_serialize = array("lastauthorid" => $fuid, "lastauthor" => $fromname, "lastsummary" => $content); $lastmessage = serialize($lastmessage_serialize); //step1 $plid = get_plid($min_max); $flag = false; if ($plid == "" || $plid == null) { $data_pm_lists = array("authorid" => $fuid, "pmtype" => 1, "subject" => $subject, "members" => 2, "min_max" => $min_max, "dateline" => $now, "lastmessage" => $lastmessage); $flag = $db->AutoExecute("disc_ucenter_pm_lists", $data_pm_lists, "INSERT"); $plid = $db->Insert_ID(); $msg = $db->ErrorMsg(); } else {
$db->query_update("users", array('pw' => $new_pw, 'last_pw_change' => mktime(0, 0, 0, date('m'), date('d'), date('y'))), "id = " . $data_received['user_id']); echo '[ { "error" : "none" } ]'; } else { echo '[ { "error" : "nothing_to_do" } ]'; } } break; case "identify_user": require_once "main.functions.php"; require_once "../sources/NestedTree.class.php"; //decrypt and retreive data in JSON format require_once '../includes/libraries/crypt/aes.class.php'; // AES PHP implementation require_once '../includes/libraries/crypt/aesctr.class.php'; // AES Counter Mode implementation $data_received = json_decode(AesCtr::decrypt($_POST['data'], SALT, 256), true); //Prepare variables $password_clear = htmlspecialchars_decode($data_received['pw']); $password = encrypt(htmlspecialchars_decode($data_received['pw'])); $username = htmlspecialchars_decode($data_received['login']); //GET SALT KEY LENGTH if (strlen(SALT) > 32) { $_SESSION['error']['salt'] = TRUE; } $_SESSION['user_language'] = $k['langage']; $ldap_connection = false; //Build tree of folders $tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title'); /* LDAP connection */ if ($debug_ldap == 1) { $dbg_ldap = fopen("../files/ldap.debug.txt", "w");
if ($action == 'rsp') { // linked clicked from password change email $user = new User(); if (!empty($_REQUEST['key'])) { $arr = explode("-", $_REQUEST['key']); $userId = $arr[0]; $keyArr = array_shift($arr); if (count($keyArr) > 1) { $key = implode("-", $arr); } else { $key = $arr[0]; } $user->Load("id = ?", array($userId)); if (!empty($user->id)) { LogManager::getInstance()->info("Key : " . $key); $data = AesCtr::decrypt($key, $user->password, 256); if (empty($data)) { $ret['status'] = "ERROR"; $ret['message'] = "Invalid Key for changing password, error decrypting data"; } else { $data = json_decode($data, true); if ($data['CLIENT_NAME'] != CLIENT_NAME || $data['email'] != $user->email) { $ret['status'] = "ERROR"; $ret['message'] = "Invalid Key for changing password, keys do not match"; } else { if (empty($_REQUEST['now'])) { LogManager::getInstance()->info("now not defined"); header("Location:" . CLIENT_BASE_URL . "login.php?cp=1&key=" . $_REQUEST['key']); } else { if (!empty($_REQUEST['pwd'])) { if (strlen($_REQUEST['pwd']) >= 6) {
<?php require 'aes.class.php'; // AES PHP implementation require 'aesctr.class.php'; // AES Counter Mode implementation ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>AES JavaScript+PHP test harness (server-side decrypt)</title> </head> <body> <!-- output the post array received and dectypt the message --> <pre>$_POST: <?php echo print_r($_POST, true); ?> </pre> <pre>Plaintext: <?php echo AesCtr::decrypt($_POST['message'], 'L0ck it up saf3', 256); ?> </pre> </body> </html>
/** * method: recv * * todo: write documentation */ public static function recv() { $base64 = Amslib_GET::get("encrypted"); if (!$base64) { self::reply(false, "missing 'encrypted' parameter"); } $encrypted = base64_decode($base64); $decrypted = AesCtr::decrypt($encrypted, self::getPassword()); try { $json = json_decode($decrypted, true); } catch (Exception $e) { // do nothing Amslib_Debug::log("Exception whilst json_decoding content"); } if (!isset($json) || !$json || !isset($json["check"])) { self::reply(false, "invalid data"); } if ($json["check"] != self::getCheck()) { self::reply(false, "check compare failed"); } unset($json["check"]); // TODO: the sender might have posted an actual file, so we need to maybe check this and // provide the file data from the $_FILES array return $json; }
<?php //开启session session_start(); require_once '../lib/config.php'; //引入AES require_once '../lib/Ss/AES/aes.class.php'; require_once '../lib/Ss/AES/aesctr.class.php'; $email = $_POST['email']; $email = strtolower($email); $passwd = AesCtr::decrypt($_POST['passwd'], $_SESSION['randomChar'], 256); $name = $_POST['name']; $repasswd = AesCtr::decrypt($_POST['repasswd'], $_SESSION['randomChar'], 256); $agree = $_POST['agree']; $code = $_POST['code']; $c = new \Ss\User\UserCheck(); $code = new \Ss\User\InviteCode($code); if (!$code->IsCodeOk()) { $a['msg'] = "邀请码无效"; } elseif (!$c->IsEmailLegal($email)) { $a['msg'] = "邮箱无效"; } elseif ($c->IsEmailUsed($email)) { $a['msg'] = "邮箱已被使用"; } elseif ($repasswd != $passwd) { $a['msg'] = "两次密码输入不符"; } elseif (strlen($passwd) < 8) { $a['msg'] = "密码太短"; } elseif (strlen($name) < 7) { $a['msg'] = "用户名太短"; } elseif ($c->IsUsernameUsed($name)) { $a['msg'] = "用户名已经被使用";
<?php require 'aes.class.php'; // AES PHP implementation require 'aesctr.class.php'; // AES Counter Mode implementation $timer = microtime(true); // initialise password & plaintesxt if not set in post array (shouldn't need stripslashes if magic_quotes is off) $pw = isset($_POST['pw']) ? stripslashes($_POST['pw']) : 'L0ck it up saf3'; $pt = isset($_POST['pt']) ? stripslashes($_POST['pt']) : 'pssst ... đon’t tell anyøne!'; $cipher = isset($_POST['cipher']) ? $_POST['cipher'] : ''; $plain = isset($_POST['plain']) ? stripslashes($_POST['plain']) : ''; $encr = isset($_POST['encr']) ? AesCtr::encrypt($pt, $pw, 256) : $cipher; $decr = isset($_POST['decr']) ? AesCtr::decrypt($_POST['cipher'], $pw, 256) : $plain; ?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>AES in PHP test harness</title> </head> <body> <form name="frm" id="frm" method="post" action=""> <!-- same-document reference --> <table> <tr> <td>Password:</td> <td><input type="text" name="pw" size="16" value="<?php echo $pw; ?> "></td>