Lines Matching refs:secret
28 $secret = '';
30 $secret .= $validChars[array_rand($validChars)];
32 return $secret;
38 * @param string $secret
42 public function getCode($secret, $timeSlice = null) argument
48 $secretkey = $this->_base32Decode($secret);
73 * @param string $secret
76 public function getQRCodeGoogleUrl($name, $secret) { argument
77 $urlencoded = urlencode('otpauth://totp/'.$name.'?secret='.$secret.'');
84 * @param string $secret
89 public function verifyCode($secret, $code, $discrepancy = 1) argument
94 $calculatedCode = $this->getCode($secret, $currentTimeSlice + $i);
121 protected function _base32Decode($secret) argument
123 if (empty($secret)) return '';
128 $paddingCharCount = substr_count($secret, $base32chars[32]);
133 …substr($secret, -($allowedValues[$i])) != str_repeat($base32chars[32], $allowedValues[$i])) return…
135 $secret = str_replace('=','', $secret);
136 $secret = str_split($secret);
138 for ($i = 0; $i < count($secret); $i = $i+8) {
140 if (!in_array($secret[$i], $base32chars)) return false;
142 … $x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, '0', STR_PAD_LEFT);
155 * @param string $secret
159 protected function _base32Encode($secret, $padding = true) argument
161 if (empty($secret)) return '';
165 $secret = str_split($secret);
167 for ($i = 0; $i < count($secret); $i++) {
168 $binaryString .= str_pad(base_convert(ord($secret[$i]), 10, 2), 8, '0', STR_PAD_LEFT);