Class Hmac

Description

class Hmac

The Hmac class provides a simple interface to the mhash library. It can be invoked to create both salted and unsalted hashed message authentication codes (HMAC). mhash was chosen because it supports a wide variety of hash algorithms. For a complete list of supported algorithms, refer to the documentation of mhash.

Located in /hmac.class.php (line 22)


	
			
Variable Summary
Method Summary
Hmac __construct ()
string GetHmac (plaintext $plaintext)
boolean IsValidHmac (ciphertext $ciphertext, plaintext $plaintext)
void SetHmacKey (plaintext $plaintext)
Variables
mixed $Hash (line 25)
  • access: private
mixed $Hmac (line 24)
  • static:
  • access: private
mixed $hmacAlgorithm (line 30)
  • access: private
mixed $hmacAlgorithmBlockSize (line 32)
  • access: private
mixed $hmacKey (line 31)
  • access: private
mixed $randomDevice (line 28)
  • access: private
mixed $saltedS2kAlgorithm (line 29)
  • access: private
mixed $XmlConfigDao (line 26)
  • access: private
Methods
Constructor __construct (line 41)

function __construct

This method is executed when an object is instantiated from this class. Preprocessing can be done here before the object is put into service.

  • access: private
Hmac __construct ()
GetHmac (line 102)

function GetHmac

The GetHmac method gets random bits from the Pseudo-Random Number Generator (PRNG), invokes the Salted S2k algorithm to further randomize the salt, hashes the plaintext including the salt and appends the salt to the end of the resultant ciphertext.

  • return: Base64 encoded ciphertext
  • access: public
string GetHmac (plaintext $plaintext)
  • plaintext $plaintext: Plaintext password
GetInstance (line 66)

function GetInstance

This method instantiates a new object from this class; more specifically, it's a singleton instance.

  • return: object instance
  • static:
  • access: public
Hmac GetInstance ()
IsValidHmac (line 122)

function IsValidHmac

The isValidHmac method validates a salted or unsalted message authentication code (HMAC).

  • return: TRUE|FALSE
  • access: public
boolean IsValidHmac (ciphertext $ciphertext, plaintext $plaintext)
  • ciphertext $ciphertext: Ciphertext
  • plaintext $plaintext: Plaintext
SetHmacKey (line 84)

function SetHmacKey

The SetHmacKey method gets random bits from the Pseudo-Random Number Generator (PRNG), invokes the Salted S2K algorithm to further randomize the salt, hashes the plaintext including the salt to create an HMAC key and stores it in the XML configuration file.

  • access: public
void SetHmacKey (plaintext $plaintext)
  • plaintext $plaintext: Plaintext password

Documentation generated on Thu, 9 Sep 2004 09:03:36 -0400 by phpDocumentor 1.3.0RC3