Re: nncp-bundle, nncp-caller, and .seen not working?

John Goerzen
2021-01-01T05:40:47Z

On Wed, Dec 30 2020, Sergey Matveev wrote:

> But here is another problem: the whole packet is hashed from
> beginning
> to the end. And changing that single block will require the
> entire
> hashing calculation to be done again. It is good that we get rid
> of
> temporary file at all, but we still need to sequentially write
> all the
> data from stdin, make seek/overwrite and then sequentially read
> all the
> data again for its checksumming.
>
> We can avoid it by using hash trees, Merkle trees. Changing of
> that
>

I think I'm following here :-)

I'm not familiar with Merkle trees, but one solution to this would
be to hash it in the order it's written at verification time: save
the first 128K in RAM, read the rest, and when you're at EOF,
supply that first 128K to the hasher and then you'd have your
calculation.

- John