aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2019-05-28 14:18:33 +0200
committerGitHub <noreply@github.com>2019-05-28 14:18:33 +0200
commit2cbee36a0184786644470a84fdd8c720cfcac58e (patch)
tree33c6040c050f85c537f8dbf5e91d8c281db092cd /src/Wallabag/CoreBundle/Helper
parent48d136d3a08d7f4ca8e0d434d8104c746d31957d (diff)
parent629a3797bcef33943df8ef5631328e05d12634ed (diff)
downloadwallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.tar.gz
wallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.tar.zst
wallabag-2cbee36a0184786644470a84fdd8c720cfcac58e.zip
Merge pull request #3944 from shtrom/always-hash-exists-url
Always hash exists url
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r--src/Wallabag/CoreBundle/Helper/UrlHasher.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/UrlHasher.php b/src/Wallabag/CoreBundle/Helper/UrlHasher.php
new file mode 100644
index 00000000..d123eaba
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Helper/UrlHasher.php
@@ -0,0 +1,23 @@
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}