forked from wallabag/wallabag
Add Wallabag\CoreBundle\Helper\UrlHasher
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
committed by
Jeremy Benoist
parent
d5744bf0df
commit
4a5516376b
22
src/Wallabag/CoreBundle/Helper/UrlHasher.php
Normal file
22
src/Wallabag/CoreBundle/Helper/UrlHasher.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Helper;
|
||||
|
||||
/**
|
||||
* Hash URLs for privacy and performance.
|
||||
*/
|
||||
class UrlHasher
|
||||
{
|
||||
/** @var string */
|
||||
const ALGORITHM = 'sha1';
|
||||
|
||||
/**
|
||||
* @param string $url
|
||||
*
|
||||
* @return string hashed $url
|
||||
*/
|
||||
public static function hashUrl(string $url)
|
||||
{
|
||||
return hash(static::ALGORITHM, $url);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user