MediaWiki  1.33.0
HOTP Class Reference

HOTP Class Based on the work of OAuth, and the sample implementation of HMAC OTP http://tools.ietf.org/html/draft-mraihi-oath-hmac-otp-04#appendix-D. More...

Static Public Member Functions

static generateByCounter ( $key, $counter)
 Generate a HOTP key based on a counter value (event based HOTP) More...
 
static generateByTime ( $key, $window, $timestamp=false)
 Generate a HOTP key based on a timestamp and window size. More...
 
static generateByTimeWindow ( $key, $window, $min=-1, $max=1, $timestamp=false)
 Generate a HOTP key collection based on a timestamp and window size all keys that could exist between a start and end time will be included in the returned array. More...
 
static getTime ()
 Gets the current time Ensures we are operating in UTC for the entire framework Restores the timezone on exit. More...
 

Detailed Description

HOTP Class Based on the work of OAuth, and the sample implementation of HMAC OTP http://tools.ietf.org/html/draft-mraihi-oath-hmac-otp-04#appendix-D.

Author
Jakob Heuser (firstname)@felocity.com
Note
2011
BSD-3-Clause
Version
1.0

Definition at line 11 of file hotp.php.

Member Function Documentation

◆ generateByCounter()

static HOTP::generateByCounter (   $key,
  $counter 
)
static

Generate a HOTP key based on a counter value (event based HOTP)

Parameters
string$keythe key to use for hashing
int$counterthe number of attempts represented in this hashing
Returns
HOTPResult a HOTP Result which can be truncated or output

Definition at line 18 of file hotp.php.

References array().

Referenced by generateByTime(), and generateByTimeWindow().

◆ generateByTime()

static HOTP::generateByTime (   $key,
  $window,
  $timestamp = false 
)
static

Generate a HOTP key based on a timestamp and window size.

Parameters
string$keythe key to use for hashing
int$windowthe size of the window a key is valid for in seconds
int | bool$timestampa timestamp to calculate for, defaults to time()
Returns
HOTPResult a HOTP Result which can be truncated or output

Definition at line 49 of file hotp.php.

References generateByCounter(), and getTime().

◆ generateByTimeWindow()

static HOTP::generateByTimeWindow (   $key,
  $window,
  $min = -1,
  $max = 1,
  $timestamp = false 
)
static

Generate a HOTP key collection based on a timestamp and window size all keys that could exist between a start and end time will be included in the returned array.

Parameters
string$keythe key to use for hashing
int$windowthe size of the window a key is valid for in seconds
int$minthe minimum window to accept before $timestamp
int$maxthe maximum window to accept after $timestamp
int | bool$timestampa timestamp to calculate for, defaults to time()
Returns
HOTPResult[]

Definition at line 72 of file hotp.php.

References $out, array(), captcha-old\count, generateByCounter(), and getTime().

Referenced by OATHAuthKey\verifyToken().

◆ getTime()

static HOTP::getTime ( )
static

Gets the current time Ensures we are operating in UTC for the entire framework Restores the timezone on exit.

Returns
int the current time

Definition at line 98 of file hotp.php.

Referenced by generateByTime(), and generateByTimeWindow().


The documentation for this class was generated from the following file: