Files
SkinbaseNova/app/Services/Uploads/UploadHashService.php
2026-02-14 15:14:12 +01:00

22 lines
366 B
PHP

<?php
declare(strict_types=1);
namespace App\Services\Uploads;
use RuntimeException;
final class UploadHashService
{
public function hashFile(string $path): string
{
$hash = hash_file('sha256', $path);
if ($hash === false) {
throw new RuntimeException('Failed to hash upload file.');
}
return $hash;
}
}