Pure-PHP implementations of keyed-hash message authentication codes (HMACs) and various cryptographic hashing functions.
Methods
Default Constructor.
Crypt_Hash(\optional $hash) : \Crypt_Hash
Parameters
$hash
\optional
String $hash
Returns
Add
_add() : String
_sha256() adds multiple unsigned 32-bit integers. Since PHP doesn't support unsigned integers and since the
possibility of overflow exists, care has to be taken. Math_BigInteger() could be used but this should be faster.
see |
\global\_sha256() |
access |
private |
Returns
String
Pure-PHP implementation of MD2
_md2($m)
Not
_not(Integer $int) : Integer
access |
private |
see |
\global\_sha256() |
Parameters
$int
Integer
Returns
Integer
Right Rotate
_rightRotate(Integer $int, Integer $amt) : Integer
access |
private |
see |
\global\_sha256() |
Parameters
$int
Integer
$amt
Integer
Returns
Integer
Right Shift
_rightShift(Integer $int, Integer $amt) : Integer
access |
private |
see |
\global\_sha256() |
Parameters
$int
Integer
$amt
Integer
Returns
Integer
Wrapper for SHA1
_sha1($m)
Pure-PHP implementation of SHA256
_sha256($m)
Pure-PHP implementation of SHA384 and SHA512
_sha512($m)
String Shift
_string_shift(String $string, \optional $index) : String
Inspired by array_shift
Parameters
$string
String
$index
\optional
Integer $index
Returns
String
Returns the hash length (in bytes)
getLength() : Integer
Compute the HMAC.
hash(String $text) : String
Parameters
$text
String
Returns
String
Sets the hash function.
setHash(String $hash)
Sets the key for HMACs
setKey(String $key)
Keys can be of any length.
Parameters
$key
String
Properties
Byte-length of compression blocks / key (Internal HMAC)
$b : Integer
see |
\global\Crypt_Hash::setAlgorithm() |
access |
private |
Hash Algorithm
$hash : String
see |
\global\Crypt_Hash::setHash() |
access |
private |
Inner XOR (Internal HMAC)
$ipad : String
see |
\global\Crypt_Hash::setKey() |
access |
private |
Key
$key : String
see |
\global\Crypt_Hash::setKey() |
access |
private |
Byte-length of hash output (Internal HMAC)
$l : Integer
see |
\global\Crypt_Hash::setHash() |
access |
private |
Outer XOR (Internal HMAC)
$opad : String
see |
\global\Crypt_Hash::setKey() |
access |
private |