diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-10-04 11:48:59 +0200 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-10-04 11:48:59 +0200 |
commit | 226e7042ee4e9259b024b94a8b7e9ffa3bfcaa7c (patch) | |
tree | 2e8f208c453b5907ef6ae43e19c242291212a563 /system | |
parent | 13be5578e7ea440f4f33bc4c5c22096686224d66 (diff) | |
parent | 824b4f220ca3dadc8f0945c665a7d7f8105a5dc4 (diff) |
Merge pull request #1847 from daniel-honestempire/develop
Support for hashing algorithms other than SHA1 and MD5
Diffstat (limited to 'system')
-rw-r--r-- | system/libraries/Encrypt.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/system/libraries/Encrypt.php b/system/libraries/Encrypt.php index 8ffd93aea..679609251 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); } } |