HmacRandomNumberGenerator
in package
implements
RandomNumberGeneratorInterface
Table of Contents
Interfaces
Properties
- $algorithm : string
- $algSize : array<string|int, mixed>
- $math : GmpMathInterface
- $messageHash : GMP
- $privateKey : PrivateKeyInterface
Methods
- __construct() : mixed
- Hmac constructor.
- bits2int() : GMP
- generate() : GMP
- Generate a random number between 0 and the specified upper boundary.
- int2octets() : string
- getHashLength() : int
Properties
$algorithm
private
string
$algorithm
$algSize
private
array<string|int, mixed>
$algSize
= array('sha1' => 160, 'sha224' => 224, 'sha256' => 256, 'sha384' => 384, 'sha512' => 512)
$math
private
GmpMathInterface
$math
$messageHash
private
GMP
$messageHash
$privateKey
private
PrivateKeyInterface
$privateKey
Methods
__construct()
Hmac constructor.
public
__construct(GmpMathInterface $math, PrivateKeyInterface $privateKey, GMP $messageHash, string $algorithm) : mixed
Parameters
- $math : GmpMathInterface
- $privateKey : PrivateKeyInterface
- $messageHash : GMP
-
- decimal hash of the message (may be truncated)
- $algorithm : string
-
- hashing algorithm
bits2int()
public
bits2int(string $bits, GMP $qlen) : GMP
Parameters
- $bits : string
-
- binary string of bits
- $qlen : GMP
-
- length of q in bits
Return values
GMPgenerate()
Generate a random number between 0 and the specified upper boundary.
public
generate(GMP $q) : GMP
Parameters
- $q : GMP
Return values
GMPint2octets()
public
int2octets(GMP $int, GMP $rlen) : string
Parameters
- $int : GMP
- $rlen : GMP
-
- rounded octet length
Return values
stringgetHashLength()
private
getHashLength(string $algorithm) : int
Parameters
- $algorithm : string