diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/UrlHasher.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/UrlHasher.php | 13 |
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 | */ |
8 | class UrlHasher | 8 | class 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 | } |