quarta-feira, 14 de janeiro de 2015
http://mydomain.com/chatwing-login?redirect_url=http%3A%2F%2Fchatwing.com%2Fchatbox%2F83206479-8cb4-455a-a0ef-59506057fa13%2Fcustomhttp://chatwing.com/chatbox/83206479-8cb4-455a-a0ef-59506057fa13/custom?custom_session=[the encrypted session]$data = array(
'id' => 1,
'name' => 'Custom Login',
'avatar' => 'http://mydomain.com/avatar/1.png',
'expire' => round(microtime(true) * 1000) + 60*60*1000 // in millisecond
);
$data = json_encode($data);
$blocksize = 16;
$secret = '';
$md5 = md5($secret);
// Strictly maintains the length of key and iv
$key = substr($md5, 0, 16);
$iv = substr($md5, 16, 16);
// We need to pad the input manually to match with the server-side's padding scheme
$pad = $blocksize - (strlen($data) % $blocksize);
$data = $data . str_repeat(chr($pad), $pad);
$encryptedSession = bin2hex(mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $data, MCRYPT_MODE_CBC, $iv));
Assinar:
Postar comentários (Atom)


Comentários