pixelfed/app/Util/Identicon/Preprocessor/HashPreprocessor.php

22 lines
398 B
PHP
Raw Normal View History

2018-05-20 03:02:13 +00:00
<?php
namespace App\Util\Identicon\Preprocessor;
class HashPreprocessor implements \Bitverse\Identicon\Preprocessor\PreprocessorInterface
{
protected $algo = 'sha256';
public function __construct($algo = 'sha256')
{
2018-08-28 03:07:36 +00:00
$this->algo = $algo;
2018-05-20 03:02:13 +00:00
}
/**
2018-08-28 03:07:36 +00:00
* {@inheritdoc}
2018-05-20 03:02:13 +00:00
*/
public function process($string)
{
return hash($this->algo, $string);
}
2018-08-28 03:07:36 +00:00
}