introduce wrapper for SHA1 functionality

This commit is contained in:
Shawn Hoffman
2022-07-23 22:45:10 -07:00
parent 91169333e9
commit dd29a54cf6
27 changed files with 256 additions and 199 deletions

View File

@ -12,6 +12,7 @@
#include <utility>
#include "Common/CommonTypes.h"
#include "Common/Crypto/SHA1.h"
#include "Common/IOFile.h"
#include "Common/Swap.h"
#include "DiscIO/Blob.h"
@ -70,7 +71,6 @@ public:
int compression_level, int chunk_size, CompressCB callback);
private:
using SHA1 = std::array<u8, 20>;
using WiiKey = std::array<u8, 16>;
// See docs/WiaAndRvz.md for details about the format
@ -82,10 +82,10 @@ private:
u32 version;
u32 version_compatible;
u32 header_2_size;
SHA1 header_2_hash;
Common::SHA1::Digest header_2_hash;
u64 iso_file_size;
u64 wia_file_size;
SHA1 header_1_hash;
Common::SHA1::Digest header_1_hash;
};
static_assert(sizeof(WIAHeader1) == 0x48, "Wrong size for WIA header 1");
@ -101,7 +101,7 @@ private:
u32 number_of_partition_entries;
u32 partition_entry_size;
u64 partition_entries_offset;
SHA1 partition_entries_hash;
Common::SHA1::Digest partition_entries_hash;
u32 number_of_raw_data_entries;
u64 raw_data_entries_offset;
@ -161,7 +161,7 @@ private:
struct HashExceptionEntry
{
u16 offset;
SHA1 hash;
Common::SHA1::Digest hash;
};
static_assert(sizeof(HashExceptionEntry) == 0x16, "Wrong size for WIA hash exception entry");
#pragma pack(pop)