On Mon, 07 Aug 2000, hal at finney.org wrote:
<> 
> There is a field for the total message length in the headers, of course.
> I assume it includes the hashes and check bytes?  So you can tell when you
> have reached the final block by keeping track of how many bytes total you
> have left.  If there are n bytes left, you need to read no more than n -
> 20 - 1 bytes as the block_data, to leave room for the hash and the control
> byte.  If this value is <= PartSize then you are on the last block.

The DataLength includes all the control characters and alike. This is for
abstractions sake, DataLength is used by the connection layer to know how much
to read of the socket, it shouldn't have to deal with control bytes and alike
(except for being able to interrupted) when things go bad.

> If there are fewer than 21 bytes left in the last block, that would be
> malformed.  I guess you should just pass the data through and then send
> a 1 to indicate bad data.

There is no hash following the last block, of course. But if the total length
of data should run out while you are reading a hash (less then 21 bytes after
and end of part), then it is indeed broken and you should send a 1.

BTW, Hal, as you noticed I decided to go with your second proposed model for a
hash that can be verified part by part. Adam called it a "progressive hash", is
that the official name?

> 
> Hal
> 
> _______________________________________________
> Freenet-dev mailing list
> Freenet-dev at lists.sourceforge.net
> http://lists.sourceforge.net/mailman/listinfo/freenet-dev
-- 
\oskar

_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev

Reply via email to