cryptal  latest
Cryptography Abstraction Layer
fpoirotte\Cryptal\Implementers\AbstractMac Class Reference
+ Inheritance diagram for fpoirotte\Cryptal\Implementers\AbstractMac:

Static Public Member Functions

static mac (MacEnum $macAlgorithm, SubAlgorithmAbstractEnum $innerAlgorithm, $key, $data, $nonce= '', $raw=false)
 

Additional Inherited Members

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

Detailed Description

Interface for Message Authentication Codes.

Definition at line 13 of file AbstractMac.php.

Member Function Documentation

static fpoirotte\Cryptal\Implementers\AbstractMac::mac ( MacEnum  $macAlgorithm,
SubAlgorithmAbstractEnum  $innerAlgorithm,
  $key,
  $data,
  $nonce = '',
  $raw = false 
)
staticfinal

All-in-one function to quickly compute the message authentication code for a string of text.

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.
string$keySecret key used to produce the Message Authentication Code.
string$dataData for which a message authentication code will be generated.
string$nonce(optional) Nonce used to randomize the output.
Note
Not all MAC algorithms make use of this parameter.
Parameters
bool$raw(optional) Whether the result should be returned in raw form (true) or using its hexadecimal representation (false). Defaults to false.
Return values
stringMessage Authentication Code for the given data.

Implements fpoirotte\Cryptal\Implementers\MacInterface.

Definition at line 15 of file AbstractMac.php.

Referenced by fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\decrypt(), fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20\decrypt(), fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\encrypt(), and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20\encrypt().


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