// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Core module" // For conditions of distribution and use, see copyright notice in Config.hpp #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include namespace Nz { /*! * \ingroup core * \class Nz::AbstractHash * \brief Core class that represents the behaviour of the hash classes * * \remark This class is abstract */ AbstractHash::~AbstractHash() = default; /*! * \brief Factory of Hash classes in function of HashType * \return A new instance of the Hash class according to the HashType * * \param type Enumeration of type HashType * * \remark If enumeration is not defined in HashType, a NazaraInternalError is thrown and nullptr is returned */ std::unique_ptr AbstractHash::Get(HashType type) { NazaraAssert(type <= HashType::Max, "Hash type value out of enum"); switch (type) { case HashType::Fletcher16: return std::make_unique(); case HashType::CRC32: return std::make_unique(); case HashType::CRC64: return std::make_unique(); case HashType::MD5: return std::make_unique(); case HashType::SHA1: return std::make_unique(); case HashType::SHA224: return std::make_unique(); case HashType::SHA256: return std::make_unique(); case HashType::SHA384: return std::make_unique(); case HashType::SHA512: return std::make_unique(); case HashType::Whirlpool: return std::make_unique(); } NazaraInternalError("Hash type not handled (0x" + NumberToString(UnderlyingCast(type), 16) + ')'); return nullptr; } }