mirror of
https://github.com/jakcron/nstool
synced 2024-11-22 13:39:28 +00:00
[nstool] Add flag to signal hash calc aligning.
This commit is contained in:
parent
bd991a25e1
commit
c1f343d052
2 changed files with 26 additions and 5 deletions
|
@ -3,7 +3,8 @@
|
|||
HashTreeMeta::HashTreeMeta() :
|
||||
mLayerInfo(),
|
||||
mDataLayer(),
|
||||
mMasterHashList()
|
||||
mMasterHashList(),
|
||||
mDoAlignHashToBlock(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -11,7 +12,8 @@ HashTreeMeta::HashTreeMeta() :
|
|||
HashTreeMeta::HashTreeMeta(const nx::HierarchicalIntegrityHeader& hdr) :
|
||||
mLayerInfo(),
|
||||
mDataLayer(),
|
||||
mMasterHashList()
|
||||
mMasterHashList(),
|
||||
mDoAlignHashToBlock(false)
|
||||
{
|
||||
importHierarchicalIntergityHeader(hdr);
|
||||
}
|
||||
|
@ -19,7 +21,8 @@ HashTreeMeta::HashTreeMeta(const nx::HierarchicalIntegrityHeader& hdr) :
|
|||
HashTreeMeta::HashTreeMeta(const nx::HierarchicalSha256Header& hdr) :
|
||||
mLayerInfo(),
|
||||
mDataLayer(),
|
||||
mMasterHashList()
|
||||
mMasterHashList(),
|
||||
mDoAlignHashToBlock(false)
|
||||
{
|
||||
importHierarchicalSha256Header(hdr);
|
||||
}
|
||||
|
@ -41,6 +44,7 @@ void HashTreeMeta::operator=(const HashTreeMeta& other)
|
|||
|
||||
void HashTreeMeta::importHierarchicalIntergityHeader(const nx::HierarchicalIntegrityHeader& hdr)
|
||||
{
|
||||
mDoAlignHashToBlock = true;
|
||||
for (size_t i = 0; i < hdr.getLayerInfo().getSize(); i++)
|
||||
{
|
||||
sLayer layer;
|
||||
|
@ -61,6 +65,7 @@ void HashTreeMeta::importHierarchicalIntergityHeader(const nx::HierarchicalInteg
|
|||
|
||||
void HashTreeMeta::importHierarchicalSha256Header(const nx::HierarchicalSha256Header& hdr)
|
||||
{
|
||||
mDoAlignHashToBlock = false;
|
||||
for (size_t i = 0; i < hdr.getLayerInfo().getSize(); i++)
|
||||
{
|
||||
sLayer layer;
|
||||
|
@ -109,11 +114,22 @@ void HashTreeMeta::setMasterHashList(const fnd::List<crypto::sha::sSha256Hash>&
|
|||
mMasterHashList = master_hash_list;
|
||||
}
|
||||
|
||||
bool HashTreeMeta::getAlignHashToBlock() const
|
||||
{
|
||||
return mDoAlignHashToBlock;
|
||||
}
|
||||
|
||||
void HashTreeMeta::setAlignHashToBlock(bool doAlign)
|
||||
{
|
||||
mDoAlignHashToBlock = doAlign;
|
||||
}
|
||||
|
||||
bool HashTreeMeta::isEqual(const HashTreeMeta& other) const
|
||||
{
|
||||
return (mLayerInfo == other.mLayerInfo) \
|
||||
&& (mDataLayer == other.mDataLayer) \
|
||||
&& (mMasterHashList == other.mMasterHashList);
|
||||
&& (mMasterHashList == other.mMasterHashList) \
|
||||
&& (mDoAlignHashToBlock == other.mDoAlignHashToBlock);
|
||||
}
|
||||
|
||||
void HashTreeMeta::copyFrom(const HashTreeMeta& other)
|
||||
|
@ -121,4 +137,5 @@ void HashTreeMeta::copyFrom(const HashTreeMeta& other)
|
|||
mLayerInfo = other.mLayerInfo;
|
||||
mDataLayer = other.mDataLayer;
|
||||
mMasterHashList = other.mMasterHashList;
|
||||
mDoAlignHashToBlock = other.mDoAlignHashToBlock;
|
||||
}
|
||||
|
|
|
@ -48,12 +48,16 @@ public:
|
|||
|
||||
const fnd::List<crypto::sha::sSha256Hash>& getMasterHashList() const;
|
||||
void setMasterHashList(const fnd::List<crypto::sha::sSha256Hash>& master_hash_list);
|
||||
|
||||
bool getAlignHashToBlock() const;
|
||||
void setAlignHashToBlock(bool doAlign);
|
||||
private:
|
||||
|
||||
// data
|
||||
fnd::List<sLayer> mLayerInfo;
|
||||
sLayer mDataLayer;
|
||||
fnd::List<crypto::sha::sSha256Hash> mMasterHashList;
|
||||
fnd::List<crypto::sha::sSha256Hash> mMasterHashList;
|
||||
bool mDoAlignHashToBlock;
|
||||
|
||||
bool isEqual(const HashTreeMeta& other) const;
|
||||
void copyFrom(const HashTreeMeta& other);
|
||||
|
|
Loading…
Reference in a new issue