<?php
$sSecretKey = 'TrueID2015tRUEid';
$json = json_encode($input);
$encrypt = fnEncrypt($json, $sSecretKey);
function fnEncrypt($sValue, $sSecretKey) {
$iv = base64_decode('Jc8EZ9nZPbWZEoV4ad8/CQ==');
$sValue = pkcs5_pad($sValue, mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
$sValue = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $sSecretKey, $sValue, MCRYPT_MODE_CBC, $iv);
$sValue = base64_encode($sValue);
return $sValue; }
function pkcs5_pad($text, $blocksize) {
$pad = $blocksize - (strlen($text) % $blocksize); $pad2 = $text . str_repeat(chr($pad), $pad); return $pad2;
}
preferences:
42.2 ms | 402 KiB | 5 Q