mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Add custom identicon preprocessor
This commit is contained in:
parent
7c1b70060c
commit
d9db890514
1 changed files with 21 additions and 0 deletions
21
app/Util/Identicon/Preprocessor/HashPreprocessor.php
Normal file
21
app/Util/Identicon/Preprocessor/HashPreprocessor.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
namespace App\Util\Identicon\Preprocessor;
|
||||
|
||||
class HashPreprocessor implements \Bitverse\Identicon\Preprocessor\PreprocessorInterface
|
||||
{
|
||||
protected $algo = 'sha256';
|
||||
|
||||
public function __construct($algo = 'sha256')
|
||||
{
|
||||
$this->algo = $algo;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function process($string)
|
||||
{
|
||||
return hash($this->algo, $string);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue