OtpCalculationTrait
A trait with shared implementation code for TOTP and HOTP
Table of Contents
- $algorithm : string
- $startTime : int
- $window : int
- calculateSerial() : int
- generateHotp() : string
- packCounter() : string
- Pack the counter to a binary string of 8 chars
- padSecret() : string
- buildHotpValue() : string
Properties
$algorithm
private
string
$algorithm
$startTime
private
int
$startTime
$window
private
int
$window
Methods
calculateSerial()
public
calculateSerial(Horde_Date $dt[, int $digits = 6 ]) : int
Parameters
- $dt : Horde_Date
- $digits : int = 6
Return values
int —generateHotp()
public
generateHotp(string $secret, int $count[, int $length = 6 ]) : string
Parameters
- $secret : string
- $count : int
- $length : int = 6
Return values
string —packCounter()
Pack the counter to a binary string of 8 chars
public
packCounter(int $counter) : string
Parameters
- $counter : int
Return values
string —padSecret()
public
padSecret(string $secret) : string
Parameters
- $secret : string
Return values
string —buildHotpValue()
private
buildHotpValue(string $hashed, int $length) : string
Parameters
- $hashed : string
- $length : int