generateOTP($count); } /** * Verify if a password is valid for a specific counter value * * @param integer $otp the one-time password * @param integer $counter the counter value * @return bool true if the counter is valid, false otherwise */ public function verify($otp, $counter) { return ($otp == $this->at($counter)); } /** * Returns the uri for a specific secret for hotp method. * Can be encoded as a image for simple configuration in * Google Authenticator. * * @param string $name the name of the account / profile * @param integer $initial_count the initial counter * @return string the uri for the hmac secret */ public function provisioning_uri($name, $initial_count) { return "otpauth://hotp/".urlencode($name)."?secret={$this->secret}&counter=$initial_count"; } } }