本文整理汇总了PHP中wa_pbkdf2函数的典型用法代码示例。如果您正苦于以下问题:PHP wa_pbkdf2函数的具体用法?PHP wa_pbkdf2怎么用?PHP wa_pbkdf2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wa_pbkdf2函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateKeys
public static function GenerateKeys($password, $nonce)
{
$array = array("key", "key", "key", "key");
$array2 = array(1, 2, 3, 4);
$nonce .= '0';
for ($j = 0; $j < count($array); $j++) {
$nonce[strlen($nonce) - 1] = chr($array2[$j]);
$foo = wa_pbkdf2("sha1", $password, $nonce, 2, 20, true);
$array[$j] = $foo;
}
return $array;
}
示例2: GenerateKeys
public static function GenerateKeys($password, $nonce)
{
$array = ['key', 'key', 'key', 'key'];
$array2 = [1, 2, 3, 4];
$nonce .= '0';
for ($j = 0; $j < count($array); $j++) {
$nonce[strlen($nonce) - 1] = chr($array2[$j]);
$foo = wa_pbkdf2('sha1', $password, $nonce, 2, 20, true);
$array[$j] = $foo;
}
return $array;
}
示例3: createAuthBlob
protected function createAuthBlob()
{
if ($this->challengeData) {
$key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challengeData, 16, 20, true);
$this->inputKey = new KeyStream($key[2], $key[3]);
$this->outputKey = new KeyStream($key[0], $key[1]);
$this->reader->setKey($this->inputKey);
//$this->writer->setKey($this->outputKey);
$phone = $this->dissectPhone();
$array = "" . $this->phoneNumber . $this->challengeData . time() . static::WHATSAPP_USER_AGENT . " MccMnc/" . str_pad($phone["mcc"], 3, "0", STR_PAD_LEFT) . "001";
$this->challengeData = null;
return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
}
return null;
}
示例4: createAuthBlob
protected function createAuthBlob()
{
if ($this->challengeData) {
$key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challengeData, 16, 20, true);
$this->inputKey = new KeyStream($key[2], $key[3]);
$this->outputKey = new KeyStream($key[0], $key[1]);
$this->reader->setKey($this->inputKey);
//$this->writer->setKey($this->outputKey);
$array = "" . $this->phoneNumber . $this->challengeData . time();
$this->challengeData = null;
return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
}
return null;
}
示例5: createAuthBlob
protected function createAuthBlob()
{
//echo $this->parent->getChallengeData() + "\n";
if ($this->parent->getChallengeData()) {
//echo 'ChallengeData Exists' + "\n";
//die;
$key = wa_pbkdf2('sha1', base64_decode($this->password), $this->parent->getChallengeData(), 16, 20, true);
$this->inputKey = new KeyStream($key[2], $key[3]);
$this->outputKey = new KeyStream($key[0], $key[1]);
$this->parent->reader->setKey($this->inputKey);
//$this->writer->setKey($this->outputKey);
$array = "" . $this->phoneNumber . $this->parent->getChallengeData() . time();
$this->parent->setChallengeData(null);
return $this->outputKey->EncodeMessage($array, 0, strlen($array), false);
}
}
示例6: create_auth_node
/**
* Add the authentication nodes.
*
* @return protocol_node Returns an authentication node.
*/
protected function create_auth_node()
{
$data = null;
if ($this->challenge_data) {
$key = wa_pbkdf2('sha1', base64_decode($this->password), $this->challenge_data, 16, 20, true);
$this->input_key = new KeyStream($key[2], $key[3]);
$this->output_key = new KeyStream($key[0], $key[1]);
$this->reader->setKey($this->input_key);
$array = "" . $this->phone_number . $this->challenge_data . time();
$this->challenge_data = null;
$data = $this->output_key->EncodeMessage($array, 0, strlen($array), false);
}
return new protocol_node("auth", array('mechanism' => 'WAUTH-2', 'user' => $this->phone_number), null, $data);
}