scmJS docs

VCOD

A verification table the game checks the file against when it loads a map, and refuses the map when the check fails. What it checks is narrow: the players' types and races, and nothing else. Every map StarEdit writes carries the same 1040 bytes, the table built into the game, and a new map made in the editor gets them too.

Name VCOD (56 43 4F 44)
Size 1040 bytes.
Read by The game, for the map list. It reads it again when a game is created and when it starts.
Required Yes. Without it the map list shows the map as Invalid Scenario, and it cannot be played.
The game accepts Exactly 1040 bytes. Any other length refuses the map.
More than one copy Every copy is checked, and one copy that fails refuses the map. A good copy after a bad one does not help.
In scmJS Kept as it is, unless it fails the game's check for the map's players: then Save writes StarEdit's table in its place.

Layout:

Offset Type Holds
0 u32 × 256 Seeds
1024 u8 × 16 Operations

What VCOD checks

The check#

When the game reads a map for the map list, it builds 432 bytes from the player slots: twelve records of 36 bytes, one per slot. Each record is zero except byte 8, the player's type from OWNR, and byte 9, the race from SIDE, for all twelve players as the file has them. It hashes those bytes twice, once with the map's VCOD and once with the table built into the game, and refuses the map as Invalid Scenario when the two answers differ. Remastered carries the same table and does the same check.

Nothing else in the map goes in: not the terrain, the units, the strings or the triggers. VCOD is not a checksum of the map, and a change to anything but OWNR and SIDE never upsets it.

The hash, for a table of 256 seeds followed by its 16 operation bytes:

hash = 0
for each 4 bytes of the 432, read as a little-endian 32-bit number w:
    b0, b1, b2, b3 = the four bytes of w, low byte first
    for each operation byte, in order:
        0:        hash = hash XOR w
        1:        hash = hash + w        (all arithmetic wraps at 32 bits)
        2:        hash = hash - w
        3, 4, 5:  hash = hash XOR seed[b0] XOR seed[b1] XOR seed[b2] XOR seed[b3]
        6:        rotate hash left by b0 mod 32, then by b1, b2 and b3 the same way
        7:        rotate hash right the same way
        8 to 255: nothing

The map passes when the two hashes are equal. So the table the game carries passes whatever OWNR and SIDE hold, and a different table passes when it happens to give the same answer for this map's players: a change to a seed that none of the 432 bytes picks makes no difference, and operations 3, 4 and 5 can stand in for each other.

The table StarEdit writes, which is the one built into the game, for a program that wants to check whether a map carries it:

Fact Value
Length 1040 bytes
SHA-256 c13ca25290b5d075eae9705d68a7b8c30af498c36c10e138627f8b49b795392f
The 16 operation bytes 01 04 05 06 02 01 05 02 00 03 07 07 05 04 06 03

An editor making a new map should copy this table: it is the only one that passes for every combination of players.