From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:Netgear CHK" |
|---|
| claim | "CHK checksums are a two-sum scheme: c0 += byte, c1 += c0 per byte (32-bit), each folded to 16 bits ((b>>16)+b)&0xFFFF with b=(c&0xFFFF)+(c>>16), result (c1<<16)|c0; image_chksum covers kernel then rootfs, header_chksum covers the 40-byte header (its own field zero) plus the board id bytes; all stored big-endian." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:Netgear CHK" |
|---|
| observed_in | |
|---|
|
|---|
| data | | trigger | "verifying or rebuilding a CHK file" |
|---|
| effect | "kernel_chksum over kernel, rootfs_chksum over rootfs, image_chksum over both, header_chksum over header+board_id" |
|---|
| condition | "header_chksum field zero while summing" |
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "netgear_checksum_add/fini and the header checksum over struct chk_header and board_id" |
|---|
| repo | "https://github.com/openwrt/firmware-utils" |
|---|
| commit | "0179ab1e367f756ac108a485f26585661d4c528c" |
|---|
| path | "src/mkchkimg.c" |
|---|
| lines | "79-112, 261-316" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "CHK checksum algorithm" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-19T06:50:47.466Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T07:18:42.475Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read mkchkimg.c at 0179ab1: netgear_checksum_add/fini (c0 += byte, c1 += c0, 16-bit fold, (c1<<16)|c0), kernel/rootfs/image/header checksums, header struct 40 bytes, header_chksum summed over the header (field still zero) plus board_id, htonl stores." |
|---|
|
|
|---|