\CI_SHA1

SHA1 Encoding Class

Purpose: Provides 160 bit hashing using The Secure Hash Algorithm developed at the National Institute of Standards and Technology. The 40 character SHA1 message hash is computationally infeasible to crack.

This class is a fallback for servers that are not running PHP greater than 4.3, or do not have the MHASH library.

This class is based on two scripts:

Marcus Campbell's PHP implementation (GNU license) http://www.tecknik.net/sha-1/

...which is based on Paul Johnston's JavaScript version (BSD license). http://pajhome.org.uk/

I encapsulated the functions and wrote one additional method to fix a hex conversion bug. - Rick Ellis

Summary

Methods
Properties
Constants
__construct()
generate()
_hex()
_ft()
_kt()
_safe_add()
_rol()
_zero_fill()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

__construct()

__construct() 

generate()

generate(  $str) : string

Generate the Hash

Parameters

$str

Returns

string

_hex()

_hex(  $str) : string

Convert a decimal to hex

Parameters

$str

Returns

string

_ft()

_ft(  $t,   $b,   $c,   $d) : string

Return result based on iteration

Parameters

$t
$b
$c
$d

Returns

string

_kt()

_kt(  $t) : string

Determine the additive constant

Parameters

$t

Returns

string

_safe_add()

_safe_add(  $x,   $y) : string

Add integers, wrapping at 2^32

Parameters

$x
$y

Returns

string

_rol()

_rol(  $num,   $cnt) : integer

Bitwise rotate a 32-bit number

Parameters

$num
$cnt

Returns

integer

_zero_fill()

_zero_fill(  $a,   $b) : string

Pad string with zero

Parameters

$a
$b

Returns

string