public function GoogleAuthenticator::createBase32Key in Google Authenticator login 7
Same name and namespace in other branches
- 6 ga4php.php \GoogleAuthenticator::createBase32Key()
Creates a base 32 key (random).
2 calls to GoogleAuthenticator::createBase32Key()
- GALoginGA::unapprovedUser in ./
ga_login.class.php - Create "user" withOUT insert.
- GoogleAuthenticator::setUser in ./
ga4php.php - Create a user.
File
- ./
ga4php.php, line 302 - Abstract GoogleAuthenticator class.
Class
- GoogleAuthenticator
- @file Abstract GoogleAuthenticator class.
Code
public function createBase32Key() {
$alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
$key = "";
for ($i = 0; $i < 16; $i++) {
$offset = rand(0, strlen($alphabet) - 1);
$key .= $alphabet[$offset];
}
return $key;
}