Wednesday, 25 July 2018

Cake php 64bit encrypt and decrypt

/*
 * Encrypt and base64 encode
 */
$encryptKey = "TESDEMO";
$secret = Security::cipher('1', $encryptKey);
$secret64Enc = base64_encode($secret);

// Decrypt your text
$secret64Dec = base64_decode($secret64Enc);
$nosecret = Security::cipher($secret64Dec,$encryptKey);
echo "$secret64Enc--------------$nosecret" ;
echo "<br>";