# 3.1.5.2 Signature Computation

There are two fields in a chunk signature: hash and block length. Given a chunk, the hash MUST be the MD4 hash [RFC1320] of the data in the chunk, and the block length MUST be the number of bytes in the chunk. Because the block length is an unsigned 16-bit integer, all chunks MUST be less than or equal to 216-1 bytes in length. Recall that the signatures comprise the data in the signature file.

The following diagram illustrates signature computation.

Figure 2: RDC signature computation

Thus, the set of signatures is specified by the following.

Note Subscripts are expressed with parentheses (for example, "boundaryi" would be expressed as "boundary(i)").

``` Let there be N chunks (0,1,... N-1) defined on a file of size n

FOR each chunk consisting of bytes from

boundary(i) to boundary(i+1)-1    -(Initial Chunks where i < N-1)
boundary(i) to n                  -(Terminal Chunk where i = N-1)

BEGIN

IF (Terminal Chunk)
Signature Hash(i) :=
MD4 of File[boundary(i)] ... File[n-1]
Signature block Length(i) := n - boundary(i)
ELSE
Signature Hash(i) :=
MD4 of File[boundary(i)] ... File[boundary(i+1)-1]
Signature block Length(i) := boundary(i+1) - boundary(i)

END
```
Show: