aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Helper/UrlHasher.php
diff options
context:
space:
mode:
authorOlivier Mehani <shtrom@ssji.net>2019-05-10 22:07:55 +1000
committerJeremy Benoist <jeremy.benoist@gmail.com>2019-05-24 15:17:46 +0200
commit4a5516376bf4c8b0cdc1e81d24ce1cca68425785 (patch)
treeccf3ced45a2841c5fdfe9010b40528bb365c32b2 /src/Wallabag/CoreBundle/Helper/UrlHasher.php
parentd5744bf0dfdbee4dbbe380d8a076d07b89fc76e6 (diff)
downloadwallabag-4a5516376bf4c8b0cdc1e81d24ce1cca68425785.tar.gz
wallabag-4a5516376bf4c8b0cdc1e81d24ce1cca68425785.tar.zst
wallabag-4a5516376bf4c8b0cdc1e81d24ce1cca68425785.zip
Add Wallabag\CoreBundle\Helper\UrlHasher
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/UrlHasher.php')
-rw-r--r--src/Wallabag/CoreBundle/Helper/UrlHasher.php22
1 files changed, 22 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..e44f219a
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Helper/UrlHasher.php
@@ -0,0 +1,22 @@
1<?php
2
3namespace Wallabag\CoreBundle\Helper;
4
5/**
6 * Hash URLs for privacy and performance.
7 */
8class UrlHasher
9{
10 /** @var string */
11 const ALGORITHM = 'sha1';
12
13 /**
14 * @param string $url
15 *
16 * @return string hashed $url
17 */
18 public static function hashUrl(string $url)
19 {
20 return hash(static::ALGORITHM, $url);
21 }
22}