public inbox for nncp-devel@lists.cypherpunks.su
Atom feed
From: John Goerzen <jgoerzen@complete•org>
To: Sergey Matveev <stargrave@stargrave•org>
Cc: nncp-devel@lists.cypherpunks.ru
Subject: Re: nncp-bundle, nncp-caller, and .seen not working?
Date: Thu, 31 Dec 2020 23:39:35 -0600	[thread overview]
Message-ID: <87czypmd0o.fsf@complete.org> (raw)
In-Reply-To: <X+zQuM1f22vn/emf@stargrave.org>


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

  parent reply	other threads:[~2021-01-01  5:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-30  6:37 nncp-bundle, nncp-caller, and .seen not working? John Goerzen
2020-12-30 14:08 ` Sergey Matveev
2020-12-30 15:37   ` John Goerzen
2020-12-30 15:44     ` John Goerzen
2020-12-30 19:10     ` Sergey Matveev
2020-12-30 19:16       ` Sergey Matveev
2021-01-01  5:36       ` John Goerzen
2021-01-02 12:56         ` Sergey Matveev
2021-01-01  5:39       ` John Goerzen [this message]
2021-01-02 13:04         ` Sergey Matveev
2021-01-06 17:15         ` Sergey Matveev
2021-01-06 18:55           ` Sergey Matveev
2021-01-07 17:56           ` John Goerzen