Class CI_SHA1 - echiong/testRepo GitHub Wiki
##Class 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
Package: [[CodeIgniter<a href="Package CodeIgniter.Libraries.md">Libraries]]
Category:
Encryption
Author:
ExpressionEngine Dev Team
Link:
http://codeigniter.com/user_guide/general/encryption.html
Located at system/libraries/Sha1.php
##Methods summary
public __construct ( )
public string generate ( string $str )
Generate the Hash
Parameters
$str
string
Returns
string
public string _hex ( string $str )
Convert a decimal to hex
Parameters
$str
string
Returns
string
public string _ft ( mixed $t, mixed $b, mixed $c, mixed $d )
Return result based on iteration
Returns
string
public string _kt ( mixed $t )
Determine the additive constant
Returns
string
public string _safe_add ( mixed $x, mixed $y )
Add integers, wrapping at 232
Returns
string
public integer _rol ( mixed $num, mixed $cnt )
Bitwise rotate a 32-bit number
Returns
integer
public string _zero_fill ( mixed $a, mixed $b )
Pad string with zero
Returns
string