nstool/lib/libhac/include/nn/hac/HierarchicalSha256Header.h

71 lines
1.5 KiB
C
Raw Permalink Normal View History

#pragma once
2018-08-07 07:17:51 +00:00
#include <nn/hac/hierarchicalsha256.h>
2018-06-24 08:18:54 +00:00
#include <fnd/ISerialisable.h>
#include <fnd/List.h>
2018-08-07 07:17:51 +00:00
namespace nn
{
namespace hac
{
class HierarchicalSha256Header :
2018-06-24 08:18:54 +00:00
public fnd::ISerialisable
{
public:
struct sLayer
{
size_t offset;
size_t size;
void operator=(const sLayer& other)
{
offset = other.offset;
size = other.size;
}
bool operator==(const sLayer& other) const
{
return (offset == other.offset && size == other.size);
}
bool operator!=(const sLayer& other) const
{
return !(*this == other);
}
};
HierarchicalSha256Header();
HierarchicalSha256Header(const HierarchicalSha256Header& other);
2018-06-24 08:18:54 +00:00
void operator=(const HierarchicalSha256Header& other);
bool operator==(const HierarchicalSha256Header& other) const;
bool operator!=(const HierarchicalSha256Header& other) const;
// export/import binary
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;
// variables
void clear();
const fnd::sha::sSha256Hash& getMasterHash() const;
void setMasterHash(const fnd::sha::sSha256Hash& master_hash);
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);
private:
const std::string kModuleName = "HIERARCHICAL_SHA256_HEADER";
// binary
2018-06-24 08:18:54 +00:00
fnd::Vec<byte_t> mRawBinary;
// data
fnd::sha::sSha256Hash mMasterHash;
size_t mHashBlockSize;
fnd::List<sLayer> mLayerInfo;
};
2018-08-07 07:17:51 +00:00
}
}