You are here

function GoogleAuthenticator::createBase32Key in Google Authenticator login 6

Same name and namespace in other branches
  1. 7 ga4php.php \GoogleAuthenticator::createBase32Key()
2 calls to GoogleAuthenticator::createBase32Key()
ga_loginGA::unapprovedUser in ./ga_login.class.php
GoogleAuthenticator::setUser in ./ga4php.php

File

./ga4php.php, line 291

Class

GoogleAuthenticator

Code

function createBase32Key() {
  $alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
  $key = "";
  for ($i = 0; $i < 16; $i++) {
    $offset = rand(0, strlen($alphabet) - 1);

    //echo "$i off is $offset\n";
    $key .= $alphabet[$offset];
  }
  return $key;
}