aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2019-05-24 15:15:12 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-24 15:17:46 +0200
commit0132ccd2a2e73a831fa198940c369bcdd5249e8b (patch)
tree1628ff3cecb2054d7abe21765af6ccda967d274d /src/Wallabag/CoreBundle/Helper
parent4a5516376bf4c8b0cdc1e81d24ce1cca68425785 (diff)
downloadwallabag-0132ccd2a2e73a831fa198940c369bcdd5249e8b.tar.gz
wallabag-0132ccd2a2e73a831fa198940c369bcdd5249e8b.tar.zst
wallabag-0132ccd2a2e73a831fa198940c369bcdd5249e8b.zip
Change the way to define algorithm for hashing url
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r--src/Wallabag/CoreBundle/Helper/UrlHasher.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/UrlHasher.php b/src/Wallabag/CoreBundle/Helper/UrlHasher.php
index e44f219a..d123eaba 100644
--- a/src/Wallabag/CoreBundle/Helper/UrlHasher.php
+++ b/src/Wallabag/CoreBundle/Helper/UrlHasher.php
@@ -7,16 +7,17 @@ namespace Wallabag\CoreBundle\Helper;
7 */ 7 */
8class UrlHasher 8class UrlHasher
9{ 9{
10 /** @var string */
11 const ALGORITHM = 'sha1';
12
13 /** 10 /**
11 * Hash the given url using the given algorithm.
12 * Hashed url are faster to be retrieved in the database than the real url.
13 *
14 * @param string $url 14 * @param string $url
15 * @param string $algorithm
15 * 16 *
16 * @return string hashed $url 17 * @return string
17 */ 18 */
18 public static function hashUrl(string $url) 19 public static function hashUrl(string $url, $algorithm = 'sha1')
19 { 20 {
20 return hash(static::ALGORITHM, $url); 21 return hash($algorithm, urldecode($url));
21 } 22 }
22} 23}