Skip to content
This repository
Browse code

Merge pull request #1847 from daniel-honestempire/develop

Support for hashing algorithms other than SHA1 and MD5
  • Loading branch information...
commit 226e7042ee4e9259b024b94a8b7e9ffa3bfcaa7c 2 parents 13be557 + 824b4f2
Andrey Andreev narfbg authored
4 system/libraries/Encrypt.php
@@ -484,7 +484,7 @@ protected function _get_mode()
484 484 */
485 485 public function set_hash($type = 'sha1')
486 486 {
487   - $this->_hash_type = ($type !== 'sha1' && $type !== 'md5') ? 'sha1' : $type;
  487 + $this->_hash_type = in_array($type, hash_algos()) ? $type : 'sha1';
488 488 }
489 489
490 490 // --------------------------------------------------------------------
@@ -497,7 +497,7 @@ public function set_hash($type = 'sha1')
497 497 */
498 498 public function hash($str)
499 499 {
500   - return ($this->_hash_type === 'sha1') ? sha1($str) : md5($str);
  500 + return hash($this->_hash_type, $str);
501 501 }
502 502
503 503 }
2  user_guide_src/source/changelog.rst
Source Rendered
@@ -204,6 +204,8 @@ Release Date: Not Released
204 204 - Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments.
205 205 - Removed the default `` `` from a number of the configuration variables.
206 206 - Added the ability to use a proxy with the :doc:`XML-RPC Library <libraries/xmlrpc>`.
  207 + - :doc:`Encryption Library <libraries/encrypt>` changes include:
  208 + - Added support for hashing algorithms other than SHA1 and MD5.
207 209
208 210 - Core
209 211

0 comments on commit 226e704

Please sign in to comment.
Something went wrong with that request. Please try again.