summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Morris <daniel@honestempire.com>2012-10-03 20:37:09 +0200
committerDaniel Morris <daniel@honestempire.com>2012-10-03 20:37:09 +0200
commita9923f5dc131f5a18175b1df3cf3f80a93ffb464 (patch)
tree8e6976478bcac5f09dade86d2483ee4d8976a96d
parent7bd1690b8b1c74ee6d6ff3868525d8cdc0ec0803 (diff)
Support for hashing algorithms other than SHA1 and MD5
Signed-off-by: Daniel Morris <daniel@honestempire.com>
-rw-r--r--system/libraries/Encrypt.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php
index 8ffd93aea..3b04f7b06 100644
--- a/system/libraries/Encrypt.php
+++ b/system/libraries/Encrypt.php
@@ -484,7 +484,7 @@ class CI_Encrypt {
*/
public function set_hash($type = 'sha1')
{
- $this->_hash_type = ($type !== 'sha1' && $type !== 'md5') ? 'sha1' : $type;
+ $this->_hash_type = (in_array($type, hash_algos())) ? $type : 'sha1';
}
// --------------------------------------------------------------------
@@ -497,7 +497,7 @@ class CI_Encrypt {
*/
public function hash($str)
{
- return ($this->_hash_type === 'sha1') ? sha1($str) : md5($str);
+ return hash($this->_hash_type, $str);
}
}