private function getHashAlgorithm(string $algorithm) : string
    {
        switch ($algorithm) {
            case Algorithms::SHA256:
                return 'sha256';
            case Algorithms::SHA384:
                return 'sha384';
            case Algorithms::SHA512:
                return 'sha512';
            default:
                throw new InvalidArgumentException("Algorithm \"$algorithm\" is not a hash algorithm");
        }
    }