Added SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 support

This commit is contained in:
Lynix
2012-05-10 00:53:36 +02:00
parent d0bc1d908a
commit 68b238fc74
23 changed files with 1621 additions and 15 deletions

View File

@@ -2,12 +2,15 @@
// This file is part of the "Nazara Engine".
// For conditions of distribution and use, see copyright notice in Config.hpp
#define NAZARA_HASH_CPP
#include <Nazara/Core/Hash.hpp>
#include <Nazara/Core/Hash/CRC32.hpp>
#include <Nazara/Core/Hash/Fletcher16.hpp>
#include <Nazara/Core/Hash/MD5.hpp>
#include <Nazara/Core/Hash/SHA1.hpp>
#include <Nazara/Core/Hash/SHA224.hpp>
#include <Nazara/Core/Hash/SHA256.hpp>
#include <Nazara/Core/Hash/SHA384.hpp>
#include <Nazara/Core/Hash/SHA512.hpp>
#include <Nazara/Core/Hash/Whirlpool.hpp>
#include <Nazara/Core/Debug.hpp>
@@ -27,6 +30,26 @@ NzHash::NzHash(nzHash hash)
m_impl = new NzHashMD5;
break;
case nzHash_SHA1:
m_impl = new NzHashSHA1;
break;
case nzHash_SHA224:
m_impl = new NzHashSHA224;
break;
case nzHash_SHA256:
m_impl = new NzHashSHA256;
break;
case nzHash_SHA384:
m_impl = new NzHashSHA384;
break;
case nzHash_SHA512:
m_impl = new NzHashSHA512;
break;
case nzHash_Whirlpool:
m_impl = new NzHashWhirlpool;
break;
@@ -48,7 +71,7 @@ NzHashDigest NzHash::Hash(const NzHashable& hashable)
m_impl->Begin();
if (hashable.FillHash(m_impl))
return m_impl->End();
else
else // Erreur
{
m_impl->End();