NORM-1 normalization
NORM-1 turns free text into one deterministic spelling so that independent implementations hash the same bytes. It applies to every text value in a gen1 recipe, and to the handle in the weak form of the acct scheme. It is never applied to the values of Class A or Class B schemes, which have their own canonicalization rules. IID spec §4.1
The algorithm
Apply the five steps in this order. The step order is frozen. A change to any step would ship as a new algorithm, NORM-2, together with a new derivation scheme, gen2. IID spec §4.2
| Step | Operation | Detail |
|---|---|---|
| 1 | Unicode NFKC | Compatibility composition. Full-width and ligature forms become their ordinary equivalents. |
| 2 | Punctuation folding | ‘ ’ ʼ become '. “ ” become ". – — − become -. |
| 3 | Unicode full case folding | Full folding, not simple lowercasing. ß and ẞ become ss, ς becomes σ, and İ becomes i followed by U+0307. |
| 4 | Trim | Remove leading and trailing whitespace. |
| 5 | Collapse | Replace each run of internal whitespace with one U+0020 space. |
A platform that offers only simple lowercasing must add the full-folding special cases from step 3 itself. Otherwise STRAẞE and strasse would hash differently on different platforms. Step 3
Worked examples
| Input | NORM-1 output |
|---|---|
" Inception " | inception |
Don’t Stop Me Now | don't stop me now |
STRAẞE | strasse |
Sigur Rós | sigur rós |
The + tab + Beatles | the beatles |
Full-width Meta | meta |
Jay–Z | jay-z |
What NORM-1 deliberately does not do
NORM-1 removes only differences that never change meaning. Anything that could merge two genuinely different names is left to the equivalence layer, where people can dispute it. IID spec §4.4
- No diacritic stripping.
BjörkandBjorkstay different. Deciding that they name the same artist is a merge decision. - Nothing language-specific. No
&toand, no moving "The" in "Beatles, The", no stemming and no transliteration. - Nothing domain-specific. Suffixes such as
(feat. …)or(Remastered)stay in place. Removing them is enrichment, before derivation. - No truncation. The full normalized value enters the hash.
Non-string values
Some recipes include dates or numbers. Format them before hashing. IID spec §4.5
| Value | Format |
|---|---|
| Date | YYYY-MM-DD. A recipe may specify the year alone, YYYY. |
| Number | The shortest decimal string that round-trips to the same value. |
| Boolean or array | Not permitted in a recipe. |
| Null or absent | The rung does not fire. |
Requirements
An implementation must apply the steps in order, as a pure function with no locale or configuration input. A value that is empty after NORM-1 is treated as absent, so a recipe that requires it does not fire. IID spec §4.6
Related
- The gen1 scheme uses NORM-1 output to build its hash preimage.
- Schemes and canonical form contrasts NORM-1 with scheme-specific canonicalization.
Applies to V2 · @0xintuition/iid 0.1.1