function GoogleAuthenticator::helperb322hex in Google Authenticator login 6
Same name and namespace in other branches
- 7 ga4php.php \GoogleAuthenticator::helperb322hex()
2 calls to GoogleAuthenticator::helperb322hex()
- ga_loginGA::unapprovedUser in ./ga_login.class.php
- GoogleAuthenticator::setUser in ./ga4php.php
File
- ./ga4php.php, line 321
Class
- GoogleAuthenticator
Code
function helperb322hex($b32) {
$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
$out = "";
$dous = "";
for ($i = 0; $i < strlen($b32); $i++) {
$in = strrpos($alphabet, $b32[$i]);
$b = str_pad(base_convert($in, 10, 2), 5, "0", STR_PAD_LEFT);
$out .= $b;
$dous .= $b . ".";
}
$ar = str_split($out, 20);
$out2 = "";
foreach ($ar as $val) {
$rv = str_pad(base_convert($val, 2, 16), 5, "0", STR_PAD_LEFT);
$out2 .= $rv;
}
return $out2;
}