2.3.1.1 SegmentDescription

The segments field is composed of a number cSegments of SegmentDescription fields. Each SegmentDescription field corresponds to a content segment in the order in which they appear in the original content. Every segment except for the last segment MUST be exactly 32 megabytes in size. The Content Information Data Structure, section 2.3, defines the content range as follows.

Content range = {Start offset, Length}

Start offset = ullOffsetInContent + dwOffsetInFirstSegment, where ullOffsetInContent is taken from the first SegmentDescription in the segments field.

Length = (Sum of cbSegment of all segments in segments field except for the first segment and last segment) + (cbSegment of first segment at which the content range begins – dwOffsetInFirstSegment) + dwReadBytesInLastSegment.

The content range extends to the end of all the segments whose SegmentDescriptions are included in the Content Information except for the last segment, for which the number of bytes is limited to dwReadBytesInLastSegment instead of the total number of bytes present in the segment.

If the content range consists of a single segment, the length is equal to the value of the dwReadBytesInLastSegment field described in section 2.3.

The SegmentDescription field and its associated subfields are formatted as follows:


0


1


2


3


4


5


6


7


8


9

1
0


1


2


3


4


5


6


7


8


9

2
0


1


2


3


4


5


6


7


8


9

3
0


1

ullOffsetInContent

...

cbSegment

cbBlockSize

SegmentHashOfData (variable)

...

SegmentSecret (variable)

...

ullOffsetInContent (8 bytes): Content offset in bytes at which the start of the segment begins.

cbSegment (4 bytes): Total number of bytes in the segment, regardless of how many of those bytes intersect the content range.

cbBlockSize (4 bytes): Length of a content block within this segment, in bytes. Every segment MUST use the block size of 65536 bytes.

SegmentHashOfData (variable): The hash of the content block hashes of every block in the segment, regardless of how many of those blocks intersect the content range. The hash is of length 32 if dwHashAlgo at the start of the Content Information was 0x800C = SHA-256, 48 if dwHashAlgo = 0x800D = SHA-384, or 64 if dwHashAlgo = 0x800E = SHA-512.

SegmentSecret (variable): Kp (section 2.2), computed as Hash (SegmentHashofData + ServerSecret) using the hash algorithm specified at the beginning of the Content Information Data Structure. The hash is of length 32 if dwHashAlgo at the start of the Content Information was 0x800C = SHA-256, 48 if dwHashAlgo = 0x800D = SHA-384 or 64 if dwHashAlgo = 0x800E = SHA-512.