Hotp
in package
implements
OtpType
Uses
OtpCalculationTrait
HOTP (RFC 6238)
Interfaces, Classes and Traits
- OtpType
- Interface of an OTP Type Definition
Table of Contents
- SUPPORTED_ALGORITHMS = ['sha1', 'sha256', 'sha512']
- $algorithm : string
- $startTime : int
- $window : int
- calculateSerial() : int
- fromJson() : self
- Construct from a JSON string with parameters
- fromParams() : void
- Construct from a plain object with parameters
- generateHotp() : string
- jsonSerialize() : mixed
- name() : string
- A human readable name
- packCounter() : string
- Pack the counter to a binary string of 8 chars
- padSecret() : string
- buildHotpValue() : string
Constants
SUPPORTED_ALGORITHMS
public
mixed
SUPPORTED_ALGORITHMS
= ['sha1', 'sha256', 'sha512']
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 —fromJson()
Construct from a JSON string with parameters
public
static fromJson(string $json) : self
Parameters
- $json : string
Return values
self —fromParams()
Construct from a plain object with parameters
public
static fromParams(object $params) : void
Parameters
- $params : object
Return values
void —generateHotp()
public
generateHotp(string $secret, int $count[, int $length = 6 ]) : string
Parameters
- $secret : string
- $count : int
- $length : int = 6
Return values
string —jsonSerialize()
public
jsonSerialize() : mixed
Return values
mixed —name()
A human readable name
public
static name() : string
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