Support for hashing algorithms other than SHA1 and MD5 #1847

Merged
merged 3 commits into from Oct 4, 2012
@@ -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);
}
}
@@ -204,6 +204,8 @@ Release Date: Not Released
- Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
- Removed the default `` `` from a number of the configuration variables.
- Added the ability to use a proxy with the :doc:`XML-RPC Library <libraries/xmlrpc>`.
+ - :doc:`Encryption Library <libraries/encrypt>` changes include:
+ - Added support for hashing algorithms other than SHA1 and MD5.
- Core