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