Public Member Functions | |
| CI_Encrypt () | |
| get_key ($key= '') | |
| set_key ($key= '') | |
| encode ($string, $key= '') | |
| decode ($string, $key= '') | |
| _xor_encode ($string, $key) | |
| _xor_decode ($string, $key) | |
| _xor_merge ($string, $key) | |
| mcrypt_encode ($data, $key) | |
| mcrypt_decode ($data, $key) | |
| _add_cipher_noise ($data, $key) | |
| _remove_cipher_noise ($data, $key) | |
| set_cipher ($cipher) | |
| set_mode ($mode) | |
| _get_cipher () | |
| _get_mode () | |
| set_hash ($type= 'sha1') | |
| hash ($str) | |
| sha1 ($str) | |
Public Attributes | |
| $CI | |
| $encryption_key = '' | |
| $_hash_type = 'sha1' | |
| $_mcrypt_exists = FALSE | |
| $_mcrypt_cipher | |
| $_mcrypt_mode | |
| CI_Encrypt::_add_cipher_noise | ( | $ | data, | |
| $ | key | |||
| ) |
Adds permuted noise to the IV + encrypted data to protect against Man-in-the-middle attacks on CBC mode ciphers http://www.ciphersbyritter.com/GLOSSARY.HTM#IV
Function description
private
| string | ||
| string |
| CI_Encrypt::_get_cipher | ( | ) |
Get Mcrypt cipher Value
private
| CI_Encrypt::_get_mode | ( | ) |
Get Mcrypt Mode Value
private
| CI_Encrypt::_remove_cipher_noise | ( | $ | data, | |
| $ | key | |||
| ) |
Removes permuted noise from the IV + encrypted data, reversing _add_cipher_noise()
Function description
public
| type |
| CI_Encrypt::_xor_decode | ( | $ | string, | |
| $ | key | |||
| ) |
XOR Decode
Takes an encoded string and key as input and generates the plain-text original message
private
| string | ||
| string |
| CI_Encrypt::_xor_encode | ( | $ | string, | |
| $ | key | |||
| ) |
XOR Encode
Takes a plain-text string and key as input and generates an encoded bit-string using XOR
private
| string | ||
| string |
| CI_Encrypt::_xor_merge | ( | $ | string, | |
| $ | key | |||
| ) |
XOR key + string Combiner
Takes a string and key as input and computes the difference using XOR
private
| string | ||
| string |
| CI_Encrypt::CI_Encrypt | ( | ) |
Constructor
Simply determines whether the mcrypt library exists.
| CI_Encrypt::decode | ( | $ | string, | |
| $ | key = '' | |||
| ) |
Decode
Reverses the above process
public
| string | ||
| string |
| CI_Encrypt::encode | ( | $ | string, | |
| $ | key = '' | |||
| ) |
Encode
Encodes the message string using bitwise XOR encoding. The key is combined with a random hash, and then it too gets converted using XOR. The whole thing is then run through mcrypt (if supported) using the randomized key. The end result is a double-encrypted message string that is randomized with each call to this function, even if the supplied message and key are the same.
public
| string | the string to encode | |
| string | the key |
| CI_Encrypt::get_key | ( | $ | key = '' |
) |
Fetch the encryption key
Returns it as MD5 in order to have an exact-length 128 bit key. Mcrypt is sensitive to keys that are not the correct length
public
| string |
| CI_Encrypt::hash | ( | $ | str | ) |
Hash encode a string
public
| string |
| CI_Encrypt::mcrypt_decode | ( | $ | data, | |
| $ | key | |||
| ) |
Decrypt using Mcrypt
public
| string | ||
| string |
| CI_Encrypt::mcrypt_encode | ( | $ | data, | |
| $ | key | |||
| ) |
Encrypt using Mcrypt
public
| string | ||
| string |
| CI_Encrypt::set_cipher | ( | $ | cipher | ) |
Set the Mcrypt Cipher
public
| constant |
| CI_Encrypt::set_hash | ( | $ | type = 'sha1' |
) |
Set the Hash type
public
| string |
| CI_Encrypt::set_key | ( | $ | key = '' |
) |
Set the encryption key
public
| string |
| CI_Encrypt::set_mode | ( | $ | mode | ) |
Set the Mcrypt Mode
public
| constant |
| CI_Encrypt::sha1 | ( | $ | str | ) |
Generate an SHA1 Hash
public
| string |
| CI_Encrypt::$_hash_type = 'sha1' |
| CI_Encrypt::$_mcrypt_cipher |
| CI_Encrypt::$_mcrypt_exists = FALSE |
| CI_Encrypt::$_mcrypt_mode |
| CI_Encrypt::$CI |
| CI_Encrypt::$encryption_key = '' |
1.5.7.1