<?php declare(strict_types=1);

namespace App\Service;

class TokenGenerator
{
    /**
     * Generate a random string using SHA1.
     *
     * @param int $length The length of the random string.
     * @return string The random string.
     */
    public function getRandomStringSha1(int $length = 16): string
    {
        $string = sha1((string)rand());

        return substr($string, 0, $length);
    }
}
