Block

Represents a block of binary data contained in a file.

Element hierarchy

<BlockMap>
<File>
<Block>

Syntax

<Block Hash  = base64Binary
       Size? = positiveInteger />

Key

? optional (zero or one)

Attributes and Elements

Attributes

Attribute Description Data type Required Default value
Hash

The hash value of the uncompressed data block.

base64Binary Yes
Size

The size, in bytes, of the data block when stored in the package. If the file data is compressed, the size of each compressed block potentially varies in size.

positiveInteger No

Child Elements

None.

Parent Elements

Parent Element Description
File

Represents a file contained in the package.

Remarks

Except for the last block of a file, Block elements represent a 64-KB (65536 bytes) block of uncompressed data within a file that is stored in the app package. Each Block element specifies a cryptographic “hash” value that is used to validate the block data. For files that are stored in the package with DEFLATE-compression, Block elements specify a Size attribute that defines to the number of compressed bytes that are used to store the compressed data sequence for the block.

The Hash attribute value is the base64 encoded value of the hash of the data represented by the Block element. When an app file is added to the app package, it is first divided into 64-KB blocks, and each block is hashed using the algorithm specified by the HashMethod attribute on the BlockMap element. If the size of the file is not an even multiple of 64 KB, the size of the final block is inferred as the remainder of the file size divided by 64 KB.

The Size attribute value is the size of the data block as stored in the app package. This is usually smaller than 64 KB because each block is commonly compressed before being stored in the app package. Because data compression (Deflate algorithm) produces a variable-length result, the Size attribute must be specified for all blocks of a file stored in compressed form within the package. The Size attribute isn't specified if the file is not compressed; if the Size attribute isn't specified, the value defaults to 64 KB, or the remainder of the file size divided by 64 KB if the block is the last block.

Requirements

Namespace

http://schemas.microsoft.com/appx/2010/blockmap