diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/UrlHasher.php | 22 |
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 | |||
3 | namespace Wallabag\CoreBundle\Helper; | ||
4 | |||
5 | /** | ||
6 | * Hash URLs for privacy and performance. | ||
7 | */ | ||
8 | class 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 | } | ||