Implementationspackage layout, build & KAT, review notes
Package layout (official Dragon.zip, extracted under harness/hash-07/Dragon/)
Dragon/Implementations and Test_vector/
├── Dragon-x86/Implementations/
│ ├── Reference_Implementation/ # <- built and timed by ngcc.dev
│ │ ├── Dragon-512/ Dragon-768/ Dragon-1024/
│ │ └── Dragon-XOF-256/ Dragon-XOF-384/ Dragon-XOF-512/
│ ├── Additional_Implementation/{Dragon-512, Dragon-768, Dragon-1024}
│ └── Optimized_Implementation/{Dragon-512, Dragon-768, Dragon-1024}
├── Dragon-ARM/Implementations/ # same shape as Dragon-x86
└── (Test_Vector/ and the Others/ self-assessment tree, see the archive)
Each instance directory holds CryptHash_AlgorithmInstance.{c,h}, KAT driver
(KAT_CryptHash.c) and the ICCS helpers (drng.c/h). The fixed-output instances share one
191-line .c; the three XOFs share a second, 245-line variant with a real multi-block squeeze loop.
All instance parameters live in the header.
Build and KAT
Prerequisites: GCC (≥ 9) and CMake. From the harness/ directory of this repository:
cd harness
make -C hash-07 # build the six instance libraries (reference)
make -C hash-07 test # run the KAT harness; summary in results/
Expected output: all six instances KAT-PASS against the submitted test vectors
(manifest kat.sha256, 24 files),
checked before every timing campaign (x86_1, 2026-09-25 → 09-28).
Review notes (ngcc.dev source review)
No deviation from the specification was found for hash-07. Parameter constants, round constants,
rotation offsets, lane mapping, padding, domain-separation rule, feed-forward and digest order all agree
(details in pseudocode.md, “Implementation vs specification”).
CryptHash()in the fixed-output instances ignoresdigest_len_bitsentirely: it always writesDIGEST_LANE_NUMlanes and returns 0. A caller passing a smaller value gets a buffer overflow; a larger one gets a silently truncated digest.ROTL64(x, 0)would be undefined behaviour, but no rotation constant is 0, so it is unreachable.- IVs are stored in reverse spec order in the header; the loader compensates, so each lane receives the
spec’s
IV_j(two 9-lane tables checked entry-by-entry; the spec’s SM3-counter derivation of the IVs was not recomputed). - Partial-byte input is handled correctly (bits beyond
msg_len_bitsmasked before padding).
Files
- Reference source tree:
harness/hash-07/Dragon/in this repository. - Official archive
Dragon.zip(148,150,104 bytes): fetch-archives.sh · SHA-256088759817e3193e0ca02c3a3669fd05ac70e833b0447f336666268b61846b26c - NICCS submission page · forum thread