summaryrefslogtreecommitdiffstats
path: root/system/libraries/Encrypt.php
diff options
context:
space:
mode:
authorPascal Kriete <pascal.kriete@ellislab.com>2010-11-04 22:59:52 +0100
committerPascal Kriete <pascal.kriete@ellislab.com>2010-11-04 22:59:52 +0100
commite917f9be8b05c81357c1c2c9730d5060685d644d (patch)
treeb6a7d5ce8ba57b69ba61454f77829b04f2ce5974 /system/libraries/Encrypt.php
parent5b2d2da5ae2e97043c6bef53e565d30e50196e2b (diff)
parente1f6e9ddff788f6a154f5f35dc117d14aeb0c484 (diff)
Automated merge with http://hg.ellislab.com/CodeIgniter2
Diffstat (limited to 'system/libraries/Encrypt.php')
-rw-r--r--system/libraries/Encrypt.php30
1 files changed, 15 insertions, 15 deletions
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index b27847a55..b95dd999c 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -144,7 +144,7 @@ class CI_Encrypt {
function decode($string, $key = '')
{
$key = $this->get_key($key);
-
+
if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
{
return FALSE;
@@ -163,12 +163,12 @@ class CI_Encrypt {
{
$dec = $this->_xor_decode($dec, $key);
}
-
+
return $dec;
}
// --------------------------------------------------------------------
-
+
/**
* Encode from Legacy
*
@@ -176,7 +176,7 @@ class CI_Encrypt {
* returns a newly encoded string using the improved method added in 2.0.0
* This allows for backwards compatibility and a method to transition to the
* new encryption algorithms.
- *
+ *
* For more details, see http://codeigniter.com/user_guide/installation/upgrade_200.html#encryption
*
* @access public
@@ -192,22 +192,22 @@ class CI_Encrypt {
log_message('error', 'Encoding from legacy is available only when Mcrypt is in use.');
return FALSE;
}
-
+
// decode it first
// set mode temporarily to what it was when string was encoded with the legacy
- // algorithm - typically MCRYPT_MODE_ECB
+ // algorithm - typically MCRYPT_MODE_ECB
$current_mode = $this->_get_mode();
$this->set_mode($legacy_mode);
-
+
$key = $this->get_key($key);
-
+
if (preg_match('/[^a-zA-Z0-9\/\+=]/', $string))
{
return FALSE;
}
$dec = base64_decode($string);
-
+
if (($dec = $this->mcrypt_decode($dec, $key)) === FALSE)
{
return FALSE;
@@ -223,7 +223,7 @@ class CI_Encrypt {
}
// --------------------------------------------------------------------
-
+
/**
* XOR Encode
*
@@ -247,7 +247,7 @@ class CI_Encrypt {
$enc = '';
for ($i = 0; $i < strlen($string); $i++)
- {
+ {
$enc .= substr($rand, ($i % strlen($rand)), 1).(substr($rand, ($i % strlen($rand)), 1) ^ substr($string, $i, 1));
}
@@ -410,7 +410,7 @@ class CI_Encrypt {
{
$temp = $temp + 256;
}
-
+
$str .= chr($temp);
}
@@ -418,7 +418,7 @@ class CI_Encrypt {
}
// --------------------------------------------------------------------
-
+
/**
* Set the Mcrypt Cipher
*
@@ -477,7 +477,7 @@ class CI_Encrypt {
{
$this->_mcrypt_mode = MCRYPT_MODE_CBC;
}
-
+
return $this->_mcrypt_mode;
}
@@ -503,7 +503,7 @@ class CI_Encrypt {
* @access public
* @param string
* @return string
- */
+ */
function hash($str)
{
return ($this->_hash_type == 'sha1') ? $this->sha1($str) : md5($str);