Core: Reworked hashes

-Removed HashDigest class (replaced by ByteArray)
-Removed Hashable/Hash classes (replaced by ComputeHash function and
Hashable template struct)
-Fixed ByteArray operator<<
-Renamed File::GetHash to File::ComputeHash


Former-commit-id: cc5eaf2d4c88a556878190b8205e66713512e2d2
This commit is contained in:
Lynix
2015-11-16 14:04:39 +01:00
parent 86da939520
commit 21f223f1c7
37 changed files with 294 additions and 621 deletions

View File

@@ -325,7 +325,7 @@ namespace Nz
m_state->abcd[3] = 0x10325476;
}
HashDigest HashMD5::End()
ByteArray HashMD5::End()
{
static const unsigned char pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -349,17 +349,16 @@ namespace Nz
for (i = 0; i < 16; ++i)
digest[i] = static_cast<UInt8>(m_state->abcd[i >> 2] >> ((i & 3) << 3));
return HashDigest(GetHashName(), &digest[0], 16);
return ByteArray(&digest[0], 16);
}
unsigned int HashMD5::GetDigestLength()
unsigned int HashMD5::GetDigestLength() const
{
return 16;
}
String HashMD5::GetHashName()
const char* HashMD5::GetHashName() const
{
static String hashName = "MD5";
return hashName;
return "MD5";
}
}