]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Helper/UrlHasher.php
Merge pull request #4438 from wallabag/dependabot/composer/scheb/two-factor-bundle...
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Helper / UrlHasher.php
CommitLineData
4a551637
OM
1<?php
2
3namespace Wallabag\CoreBundle\Helper;
4
5/**
6 * Hash URLs for privacy and performance.
7 */
8class UrlHasher
9{
4a551637 10 /**
0132ccd2
JB
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 *
0132ccd2 14 * @param string $algorithm
4a551637 15 *
0132ccd2 16 * @return string
4a551637 17 */
0132ccd2 18 public static function hashUrl(string $url, $algorithm = 'sha1')
4a551637 19 {
0132ccd2 20 return hash($algorithm, urldecode($url));
4a551637
OM
21 }
22}