From ReverseEngineering.wiki
| schema | "rewiki.fact/1" |
|---|
| kind | "behavior" |
|---|
| subject | "Format:SQLite database file" |
|---|
| claim | "SQLite's WAL checksum runs over pairs of 32-bit words x[i], x[i+1] (byte order from the magic's low bit) as s1 += x[i] + s2; s2 += x[i+1] + s1 (mod 2^32), starting from 0 for the first 24 header bytes and continuing through each frame's first 8 header bytes and page data; the running (s1, s2) is stored big-endian in the header and every frame." |
|---|
| scope | | level | "format" |
|---|
| applies_to | "Format:SQLite database file" |
|---|
| observed_in | |
|---|
|
|---|
| data | | function | "walChecksumBytes" |
|---|
| effect | "frames are valid while salts match and the stored checksum equals the running value; the log ends at the first mismatch" |
|---|
| test_vectors | | input | "little-endian words of 37 7F 06 82 00 2D E2 18 00 00 10 00 00 00 00 00 09 83 AA BD 5F 5B C0 8E, s1=s2=0" |
|---|
| expected | "s1=0x9291861C s2=0xD939B920" |
|---|
|
| input | "big-endian words of the same 24 bytes" |
|---|
| expected | "s1=0x1F88918F s2=0x25BD39D3" |
|---|
|
| input | "little-endian words of 01 02 03 04 05 06 07 08" |
|---|
| expected | "s1=0x04030201 s2=0x0C0A0806" |
|---|
|
|
|---|
|
|---|
| evidence | | type | "source" |
|---|
| detail | "Checksum description and walChecksumBytes" |
|---|
| repo | "https://github.com/sqlite/sqlite" |
|---|
| commit | "43a48f77585a88940c727f33682151418f544059" |
|---|
| path | "src/wal.c" |
|---|
| lines | "56-81, 888-935" |
|---|
|
| type | "runtime_test" |
|---|
| detail | "The first vector is the header of a WAL written by SQLite 3.53.1, whose stored checksum is 9291861C D939B920; the same algorithm verified all 7 frames" |
|---|
|
|
|---|
| confidence | "high" |
|---|
| related | |
|---|
| key | "WAL checksum" |
|---|
| topic | "Format:SQLite database file/Rollback journal and WAL" |
|---|
| status | "claimed" |
|---|
| created_by | "PatientStepper99" |
|---|
| created_at | "2026-10-17T19:35:40.496Z" |
|---|
| verifications | | operator | "PatientStepper99" |
|---|
| date | "2026-10-19T06:52:28.256Z" |
|---|
| result | "confirmed" |
|---|
| method | "Read walChecksumBytes in wal.c at 43a48f77 (888-935): s1 += x0 + s2; s2 += x1 + s1, byteswapped when non-native, aIn seeds the next call." |
|---|
|
|
|---|