Grin: Hash index along with element's hash in PMMR

Created on 26 Feb 2018  路  3Comments  路  Source: mimblewimble/grin

We originally generated the hash to append to the PMMR by
concatenating the pos, the sum and the output hash
and hashing them together -

let node_hash = (idx, &sum, hash).hash();
HashSum {
    hash: node_hash,
    sum: sum,
}

I _think_ we are now simply using the hash of the output (and not including the pos in there)?
Do we need to include the pos in the data that we are hashing?

let mut current_hash = elmt.hash();

We simplified the PMMR to get rid of the Sum so that is no longer relevant.
But do we still need the pos in there?

I'm not clear on what the rationale was for originally including the pos in the data being hashed.
Presumably each entry in the PMMR would be pos specific and unique even if the same output was added multiple times?

@yeastplume @ignopeverell

question

Most helpful comment

If that's the case I can get the position back in there.. about to delve back into storage anyhow for the PMMR index files.

All 3 comments

I think we do, it provides additional collision resistance.

If that's the case I can get the position back in there.. about to delve back into storage anyhow for the PMMR index files.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

garyyu picture garyyu  路  4Comments

antiochp picture antiochp  路  7Comments

shrikus picture shrikus  路  6Comments

antiochp picture antiochp  路  6Comments

ignopeverell picture ignopeverell  路  3Comments