SMM 2 > Level Files

All level files have the same size in Super Mario Maker 2:

OffsetSizeDescription
0x00x10File header
0x100x5BFC0File body (encrypted)
0x5BFD00x30Crypto parameters

Encryption

The file body is encrypted with AES-CBC. The following structure is stored at the end of the level file:

OffsetSizeDescription
0x016Initialization vector
0x104 x 4Random number generator state
0x2016AES-CMAC of decrypted data

The ENL key generation algorithm is used to generate the keys. However, instead of initializing the random number generator by seed, its internal state is initialized directly with the values from the structure above. Two keys are generated (with the same random number generator):

  1. A 16-byte key to decrypt the file body
  2. A 16-byte key to calculate or verify the CMAC

The following integer table is passed to the key generation algorithm:

table = [
	0x7AB1C9D2, 0xCA750936, 0x3003E59C, 0xF261014B,
	0x2E25160A, 0xED614811, 0xF1AC6240, 0xD59272CD,
	0xF38549BF, 0x6CF5B327, 0xDA4DB82A, 0x820C435A,
	0xC95609BA, 0x19BE08B0, 0x738E2B81, 0xED3C349A,
	0x045275D1, 0xE0A73635, 0x1DEBF4DA, 0x9924B0DE,
	0x6A1FC367, 0x71970467, 0xFC55ABEB, 0x368D7489,
	0x0CC97D1D, 0x17CC441E, 0x3528D152, 0xD0129B53,
	0xE12A69E9, 0x13D1BDB7, 0x32EAA9ED, 0x42F41D1B,
	0xAEA5F51F, 0x42C5D23C, 0x7CC742ED, 0x723BA5F9,
	0xDE5B99E3, 0x2C0055A4, 0xC38807B4, 0x4C099B61,
	0xC4E4568E, 0x8C29C901, 0xE13B34AC, 0xE7C3F212,
	0xB67EF941, 0x08038965, 0x8AFD1E6A, 0x8E5341A3,
	0xA4C61107, 0xFBAF1418, 0x9B05EF64, 0x3C91734E,
	0x82EC6646, 0xFB19F33E, 0x3BDE6FE2, 0x17A84CCA,
	0xCCDF0CE9, 0x50E4135C, 0xFF2658B2, 0x3780F156,
	0x7D8F5D68, 0x517CBED1, 0x1FCDDF0D, 0x77A58C94
]

File Header

The header is not encrypted.

OffsetSizeDescription
0x04Always 1
0x42Always 16
0x62Always 1
0x84CRC32 of decrypted file body
0xC4Magic number (always SCDL)

File Body

OffsetSizeDescription
0x00x200Course metadata
0x2000x2DEE0Unknown
0x2E0E00x2DEE0Unknown

Course Metadata

OffsetSizeDescription
0x04Unknown
0x42Time limit
0x62Unknown
0x82Creation year
0xA1Creation month
0xB1Creation day
0xC1Creation hour
0xD1Creation minute
0xE2Unknown
0x104Unknown
0x144Unknown
0x188Unknown
0x204Unknown
0x244Random number seed
0x280xC0Unknown
0xF01Unknown
0xF13Unknown
0xF40x20Level name (utf16)
0x1140xECUnknown