2018-05-19 03:57:40 +00:00
|
|
|
#pragma once
|
2018-08-07 07:17:51 +00:00
|
|
|
#include <nn/hac/hierarchicalsha256.h>
|
2018-10-14 05:45:09 +00:00
|
|
|
#include <fnd/IByteModel.h>
|
2018-05-19 03:57:40 +00:00
|
|
|
#include <fnd/List.h>
|
|
|
|
|
2018-08-07 07:17:51 +00:00
|
|
|
namespace nn
|
|
|
|
{
|
|
|
|
namespace hac
|
2018-05-19 03:57:40 +00:00
|
|
|
{
|
|
|
|
class HierarchicalSha256Header :
|
2018-10-14 05:45:09 +00:00
|
|
|
public fnd::IByteModel
|
2018-05-19 03:57:40 +00:00
|
|
|
{
|
|
|
|
public:
|
2018-05-20 01:19:41 +00:00
|
|
|
struct sLayer
|
|
|
|
{
|
|
|
|
size_t offset;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
void operator=(const sLayer& other)
|
|
|
|
{
|
|
|
|
offset = other.offset;
|
|
|
|
size = other.size;
|
|
|
|
}
|
|
|
|
|
2018-05-20 13:57:38 +00:00
|
|
|
bool operator==(const sLayer& other) const
|
2018-05-20 01:19:41 +00:00
|
|
|
{
|
|
|
|
return (offset == other.offset && size == other.size);
|
|
|
|
}
|
|
|
|
|
2018-05-20 13:57:38 +00:00
|
|
|
bool operator!=(const sLayer& other) const
|
2018-05-20 01:19:41 +00:00
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
};
|
2018-05-19 03:57:40 +00:00
|
|
|
|
|
|
|
HierarchicalSha256Header();
|
|
|
|
HierarchicalSha256Header(const HierarchicalSha256Header& other);
|
|
|
|
|
2018-06-24 08:18:54 +00:00
|
|
|
void operator=(const HierarchicalSha256Header& other);
|
2018-05-19 03:57:40 +00:00
|
|
|
bool operator==(const HierarchicalSha256Header& other) const;
|
|
|
|
bool operator!=(const HierarchicalSha256Header& other) const;
|
|
|
|
|
2018-10-18 12:48:16 +00:00
|
|
|
// IByteModel
|
2018-06-24 08:18:54 +00:00
|
|
|
void toBytes();
|
|
|
|
void fromBytes(const byte_t* bytes, size_t len);
|
|
|
|
const fnd::Vec<byte_t>& getBytes() const;
|
2018-05-19 03:57:40 +00:00
|
|
|
|
|
|
|
// variables
|
|
|
|
void clear();
|
|
|
|
|
2018-08-07 08:35:03 +00:00
|
|
|
const fnd::sha::sSha256Hash& getMasterHash() const;
|
|
|
|
void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
|
2018-05-19 03:57:40 +00:00
|
|
|
|
2018-05-20 01:19:41 +00:00
|
|
|
size_t getHashBlockSize() const;
|
|
|
|
void setHashBlockSize(size_t hash_block_size);
|
|
|
|
|
|
|
|
const fnd::List<sLayer>& getLayerInfo() const;
|
|
|
|
void setLayerInfo(const fnd::List<sLayer>& layer_info);
|
2018-05-19 03:57:40 +00:00
|
|
|
private:
|
|
|
|
const std::string kModuleName = "HIERARCHICAL_SHA256_HEADER";
|
|
|
|
|
|
|
|
// binary
|
2018-06-24 08:18:54 +00:00
|
|
|
fnd::Vec<byte_t> mRawBinary;
|
2018-05-19 03:57:40 +00:00
|
|
|
|
|
|
|
// data
|
2018-08-07 08:35:03 +00:00
|
|
|
fnd::sha::sSha256Hash mMasterHash;
|
2018-05-20 01:19:41 +00:00
|
|
|
size_t mHashBlockSize;
|
|
|
|
fnd::List<sLayer> mLayerInfo;
|
2018-05-19 03:57:40 +00:00
|
|
|
};
|
2018-08-07 07:17:51 +00:00
|
|
|
}
|
2018-05-19 03:57:40 +00:00
|
|
|
}
|