Skip to content

Encoding file

d07RiV edited this page Mar 6, 2016 · 4 revisions

Encoding file contains the mapping from content hashes to CDN (file) hashes, and defines the compression layout for files.

This binary file can be obtained from the CDN data URL, using the second encoding hash found in the build-config file. Example URL:

http://blzddist1-a.akamaihd.net/tpr/d3/data/1d/d1/1dd1cf5ae8b9fd3f6c14ad12bc8406a6

File format

Encoding files have the following structure:

  • Header
  • Layout string block
  • Key table index (table A)
  • Key table entries
  • Layout table index (table B)
  • Layout table entries
  • Encoding file layout string

Data structures

  • Header (22 bytes)
Offset Type Name Description
0x00 char[2] Signature "EN"
0x02 uint8 Unknown ???
0x03 uint8 HashSizeA Always 0x10 (16 bytes)
0x04 uint8 HashSizeB Always 0x10 (16 bytes)
0x05 uint16 FlagsA Unknown flags
0x07 uint16 FlagsB Unknown flags
0x09 uint32 [BE] SizeA Number of key table entries
0x0D uint32 [BE] SizeB Number of layout table entries
0x11 uint8 Unknown ???
0x12 uint32 [BE] StringSize Size of the layout string block, in bytes
  • Layout string block

Consists of a list of null-terminated strings describing the possible file compression layouts - see Layout string.

  • Key table index (32 bytes, array)

Consists of SizeA entries of the following format:

Offset Type Name Description
0x00 char[16] FirstHash Hash of the first file in the entry
0x10 char[16] EntryHash MD5 checksum of the entire entry
  • Key table entries (variable size, padded array)

Consists of SizeA zero-padded blocks of 4096 bytes each, filled with the following (variable size) entries:

Offset Type Name Description
0x00 uint16 [LE] KeyCount Number of CDN keys
0x02 uint32 [BE] DecompressedSize Size of the decompressed file
0x06 char[16] Hash Content hash of the file
0x16 char[KeyCount][16] Keys Array of file CDN keys
  • Layout table index (32 bytes, array)

Consists of SizeB entries of the following format:

Offset Type Name Description
0x00 char[16] FirstKey Key of the first file in the entry
0x10 char[16] EntryHash MD5 checksum of the entire entry
  • Layout table entries (25 bytes, padded array)

Consists of SizeB zero-padded blocks of 4096 bytes each, filled with the following entries:

Offset Type Name Description
0x00 char[16] Key CDN key of the file
0x10 uint32 [BE] StringIndex Index of the layout string in the table
0x14 uint8 Unknown ???
0x15 uint32 [BE] CompressedSize Size of the compressed file
  • Encoding file layout string

Layout string describing the encoding file itself.

Key table

The key table defines the mapping from content hashes to CDN hashes. The entries within the file are sorted by the hash, which allows searching for them using two binary searches if one doesn't wish to create a secondary hash structure.

Each file can theoretically have multiple CDN keys, but it is rarely observed in practice.

Layout table

Layout table can be used to find the compressed size and compression layout of individual files by their CDN key.

Layout string

Layout strings describe the chunks into which the file is broken down in BLTE containers. This information is only necessary to compress the files, as BLTE containers contain sufficient information to decompress files without having to parse these strings. A description of the string format can be found on wowdev Wiki.

Clone this wiki locally