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

From: John Goerzen <[email-masked]>
Date: Thu, 31 Dec 2020 23:39:35 -0600

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