本文整理汇总了PHP中Encrypt::currentKey1方法的典型用法代码示例。如果您正苦于以下问题:PHP Encrypt::currentKey1方法的具体用法?PHP Encrypt::currentKey1怎么用?PHP Encrypt::currentKey1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Encrypt
的用法示例。
在下文中一共展示了Encrypt::currentKey1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: firstDecrypt
/**
* Decrypts the packets received from the client on the first connection
*/
public function firstDecrypt($client, $data)
{
$firstClientKey = self::$clients[(int) UltimaPHP::$conf['server']['client']['major'] . (int) UltimaPHP::$conf['server']['client']['minor'] . (int) UltimaPHP::$conf['server']['client']['revision']][0];
$secondClientKey = self::$clients[(int) UltimaPHP::$conf['server']['client']['major'] . (int) UltimaPHP::$conf['server']['client']['minor'] . (int) UltimaPHP::$conf['server']['client']['revision']][1];
$len = strlen($data);
for ($i = 0; $i < $len; $i++) {
$data[$i] = self::$currentKey0 ^ $data[$i];
$oldkey0 = self::$currentKey0;
$oldkey1 = self::$currentKey1;
self::$currentKey0 = ($oldkey0 >> 1 | $oldkey1 << 31) ^ $secondClientKey;
self::$currentKey1 = ((($oldkey1 >> 1 | $oldkey0 << 31) ^ $firstClientKey - 1) >> 1 | $oldkey0 << 31) ^ $firstClientKey;
}
return $data;
}