forked from wallabag/wallabag
Move source files directly under src/ directory
This commit is contained in:
22
src/Helper/UrlHasher.php
Normal file
22
src/Helper/UrlHasher.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Wallabag\CoreBundle\Helper;
|
||||
|
||||
/**
|
||||
* Hash URLs for privacy and performance.
|
||||
*/
|
||||
class UrlHasher
|
||||
{
|
||||
/**
|
||||
* Hash the given url using the given algorithm.
|
||||
* Hashed url are faster to be retrieved in the database than the real url.
|
||||
*
|
||||
* @param string $algorithm
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function hashUrl(string $url, $algorithm = 'sha1')
|
||||
{
|
||||
return hash($algorithm, urldecode($url));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user