cryptal  latest
Cryptography Abstraction Layer
fpoirotte\Cryptal\DefaultAlgorithms\Umac Class Reference
+ Inheritance diagram for fpoirotte\Cryptal\DefaultAlgorithms\Umac:

Public Member Functions

 __construct (MacEnum $macAlgorithm, SubAlgorithmAbstractEnum $innerAlgorithm, $key, $nonce= '')
 
- Public Member Functions inherited from fpoirotte\Cryptal\AbstractContextBasedAlgorithm
 __toString ()
 
 finalize ($raw=false)
 
 update ($data)
 
- Public Member Functions inherited from fpoirotte\Cryptal\ContextBasedInterface
 __toString ()
 
 finalize ($raw=false)
 
 update ($data)
 

Public Attributes

const PRIME_128 = '0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF61'
 128-bits prime number, in hexadecimal notation.
 
const PRIME_36 = '0x0000000FFFFFFFFB'
 36-bits prime number, in hexadecimal notation.
 
const PRIME_64 = '0xFFFFFFFFFFFFFFC5'
 64-bits prime number, in hexadecimal notation.
 

Protected Member Functions

 internalFinalize ()
 
 internalUpdate ($data)
 
 KDF ($index, $numbytes)
 
 l1Hash ($k, $m)
 
 l2Hash ($k, $m)
 
 l3Hash ($k1, $k2, $m)
 
 NH ($k_i, $m, $len)
 
 PDF ($nonce)
 
 POLY ($wordbits, $maxwordrange, $k, $m)
 
 UHASH ($m)
 
- Protected Member Functions inherited from fpoirotte\Cryptal\AbstractContextBasedAlgorithm
 internalFinalize ()
 
 internalUpdate ($data)
 

Protected Attributes

 $blkSize
 Block size for the cipher.
 
 $cipher
 Cipher algorithm used to encrypt data.
 
 $taglen
 Length of tags generated by this instance.
 

Static Protected Attributes

static $twop32
 = 2**32
 
static $twop64
 = 2**64
 

Private Attributes

 $key
 Secret key.
 
 $nonce
 Nonce.
 

Additional Inherited Members

- Static Public Member Functions inherited from fpoirotte\Cryptal\Implementers\AbstractMac
static mac (MacEnum $macAlgorithm, SubAlgorithmAbstractEnum $innerAlgorithm, $key, $data, $nonce= '', $raw=false)
 

Detailed Description

Message authentication code based on universal hashing.

Definition at line 18 of file Umac.php.

Constructor & Destructor Documentation

fpoirotte\Cryptal\DefaultAlgorithms\Umac::__construct ( MacEnum  $macAlgorithm,
SubAlgorithmAbstractEnum  $innerAlgorithm,
  $key,
  $nonce = '' 
)

Construct a new context to generate a Message Authentication Code.

Parameters
MacEnum$macAlgorithmAlgorithm to use to produce the message authentication code.
SubAlgorithmAbstractEnum$innerAlgorithmInner algorithm used during generation. This should be either an instance of CipherEnum or MacEnum, depending on the value for the $macAlgorithm parameter.
Warning
For MAC algorithms that use ciphers, the cipher must be configured to use the Electronic Codebook (ECB) mode. Other modes of operations will result in garbage output.
Parameters
string$keySecret key used to produce the Message Authentication Code.
string$nonce(optional) Nonce used to randomize the output.
Note
Not all MAC algorithms make use of this parameter.

Implements fpoirotte\Cryptal\Implementers\MacInterface.

Definition at line 50 of file Umac.php.

References fpoirotte\Cryptal\DefaultAlgorithms\Umac\$blkSize, fpoirotte\Cryptal\DefaultAlgorithms\Umac\$cipher, fpoirotte\Cryptal\DefaultAlgorithms\Umac\$key, fpoirotte\Cryptal\DefaultAlgorithms\Umac\$nonce, and fpoirotte\Cryptal\DefaultAlgorithms\Umac\$taglen.


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