mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-03-06 05:28:17 +01:00
akwizgran created page: BSP
@@ -18,10 +18,10 @@ Each message consists of one or more blocks, each block_len bytes long, except t
|
||||
|
||||
The message's unique identifier is calculated by hashing a message header concatenated with the root hash of the tree. The message header consists of the channel identifier, a timestamp, the message length and the message type.
|
||||
|
||||
The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian and signed.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the application and not interpreted by BSP. The length of the message header is hash_len + 17 bytes.
|
||||
The timestamp is a 64-bit integer representing seconds since the Unix epoch. (All integers in BSP are big-endian and signed.) The message length is a 64-bit integer representing the length of the message in bytes. The message type is a single byte that is supplied by the application and not interpreted by BSP.
|
||||
|
||||
Each block also has a unique identifier, which is calculated by hashing the message header concatenated with a block header and the hash of the block itself. The block header consists of the block number and a list of hashes called the path.
|
||||
|
||||
The block number is a 64-bit integer starting from zero for the first block of the file. The path contains the hashes of the block's ancestors' siblings in the hash tree. If the number of blocks is not a power of two, some ancestors may not have siblings. The positions of any nonexistent siblings can be calculated from the message length and the block number.
|
||||
The block number is a 64-bit integer starting from zero for the first block of the message. The path contains the hashes of the block's ancestors' siblings in the hash tree. If the number of blocks is not a power of two, some ancestors may not have siblings. The positions of any nonexistent siblings can be calculated from the message length and the block number.
|
||||
|
||||
Given the message header, block header and block, it is possible to check that the message header, block header and block are consistent, and to calculate the message identifier. Any blocks that produce the same message identifier must have consistent message and block headers. This makes it possible to synchronise messages a block at a time by including the message header and block header with each block.
|
||||
A block accompanied by its message and block headers is called a portable block. A portable block is valid if the message and block headers are consistent with each other and with the length of the block. A portable block contains all the information needed to calculate the message identifier. Any valid portable blocks that produce the same message identifier are guaranteed to be consistent with each other. This makes it possible to synchronise messages a block at a time.
|
||||
|
||||
Reference in New Issue
Block a user