SecureLogin

Crypt_Hash Class Reference

Public Member Functions

 Crypt_Hash ($hash= 'sha1')
 setKey ($key)
 setHash ($hash)
 hash ($text)
 getLength ()
 _md5 ($m)
 _sha1 ($m)
 _md2 ($m)
 _sha256 ($m)
 _sha512 ($m)
 _rightRotate ($int, $amt)
 _rightShift ($int, $amt)
 _not ($int)
 _add ()
 _string_shift (&$string, $index=1)

Data Fields

 $b
 $l = false
 $hash
 $key = ''
 $opad
 $ipad

Member Function Documentation

_add ( )

Add

_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.

Parameters:
String$string
optionalInteger $index
Returns:
String
See also:
_sha256() private
_md2 ( m)

Pure-PHP implementation of MD2

See RFC1319.

private

Parameters:
String$text
_md5 ( m)

Wrapper for MD5

private

Parameters:
String$text
_not ( int)

Not

private

Parameters:
Integer$int
See also:
_sha256()
Returns:
Integer
_rightRotate ( int,
amt 
)

Right Rotate

private

Parameters:
Integer$int
Integer$amt
See also:
_sha256()
Returns:
Integer
_rightShift ( int,
amt 
)

Right Shift

private

Parameters:
Integer$int
Integer$amt
See also:
_sha256()
Returns:
Integer
_sha1 ( m)

Wrapper for SHA1

private

Parameters:
String$text
_sha256 ( m)

Pure-PHP implementation of SHA256

See SHA-256 (a SHA-2 variant) pseudocode - Wikipedia.

private

Parameters:
String$text
_sha512 ( m)

Pure-PHP implementation of SHA384 and SHA512

private

Parameters:
String$text
_string_shift ( &$  string,
index = 1 
)

String Shift

Inspired by array_shift

Parameters:
String$string
optionalInteger $index
Returns:
String private
Crypt_Hash ( hash = 'sha1')

Default Constructor.

Parameters:
optionalString $hash
Returns:
Crypt_Hash public
getLength ( )

Returns the hash length (in bytes)

private

Returns:
Integer
hash ( text)

Compute the HMAC.

public

Parameters:
String$text
Returns:
String
setHash ( hash)

Sets the hash function.

public

Parameters:
String$hash
setKey ( key)

Sets the key for HMACs

Keys can be of any length.

public

Parameters:
String$key

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables