Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Support for hashing algorithms other than SHA1 and MD5

Signed-off-by: Daniel Morris <daniel@honestempire.com>
  • Loading branch information...
commit a9923f5dc131f5a18175b1df3cf3f80a93ffb464 1 parent 7bd1690
@unfunco unfunco authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 system/libraries/Encrypt.php
View
4 system/libraries/Encrypt.php
@@ -484,7 +484,7 @@ protected function _get_mode()
*/
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 @@ public function set_hash($type = 'sha1')
*/
public function hash($str)
{
- return ($this->_hash_type === 'sha1') ? sha1($str) : md5($str);
+ return hash($this->_hash_type, $str);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.