]> git.immae.eu Git - github/wallabag/wallabag.git/blob - src/Wallabag/CoreBundle/Helper/UrlHasher.php
Update deps
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / UrlHasher.php
1 <?php
2
3 namespace Wallabag\CoreBundle\Helper;
4
5 /**
6 * Hash URLs for privacy and performance.
7 */
8 class UrlHasher
9 {
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 $algorithm
15 *
16 * @return string
17 */
18 public static function hashUrl(string $url, $algorithm = 'sha1')
19 {
20 return hash($algorithm, urldecode($url));
21 }
22 }