<?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;
    }
}
