The new NHI format has been implemented to further extend the NHI range as we were previously running out of NHIs. The new format is:
AAA00AA
Where A is an alpha character between A and Z, excluding the letters I and O and 0 is a number ranging from 0-9. The final alpha is the check digit.
The previous NHI had a collision issue, where the check-digit for any given transposition of an alpha character could result in a check digit with the same value. This was a result of the check digit having a value range of only 10 digits (0-9) with an input range of 24 characters as positions 1-3.
The new NHI however has a check digit which can be 24 values in length.
There appears however to be a significant flaw in the implementation. The new algorithm uses a modulus 24 operation but has used the same second factor values at each position of the NHI. The original second factor values are now factors of the modulus, which results in significant numbers of collisions. This issue didn’t arise in the old NHI algorithm as the modulus was a prime number.
An example is shown below, showing all combinations of the NHI ZAD96LT, changing the second letter:
NHI | Check Digit |
ZAD96L | T |
ZBD96L | M |
ZCD96L | F |
ZDD96L | Z |
ZED96L | T |
ZFD96L | M |
ZGD96L | F |
ZHD96L | Z |
ZJD96L | T |
ZKD96L | M |
ZLD96L | F |
ZMD96L | Z |
ZND96L | T |
ZPD96L | M |
ZQD96L | F |
ZRD96L | Z |
ZSD96L | T |
ZTD96L | M |
ZUD96L | F |
ZVD96L | Z |
ZWD96L | T |
ZXD96L | M |
ZYD96L | F |
ZZD96L | Z |
You can see the check digit repeats every 4 iterations. This means that each letter at position 2 has 5 different characters which would be transposed and the check algorithm would not detect as issue. Compared to the old NHI algorithm, which 11 characters had only one other letter which could be transposed without detection and 2 characters which had 2 others which wouldn’t be detected by a transposition.
Because the second factors of 7 and 5 are not factors of the modulus, this issue with the new NHI only affects transposition at positions 2,4,5 and 6 of the NHI.
This issue could be avoided by either changing the modulus to a number which does not have the existing second factors as factors (e.g. modulus 23) or by keeping modulus 24 while changing the second factors (e.g. using 14,13,10,7,5 as the second factors.
These would look like:
NHI | Mod 23 | Mod 24 + New Facs |
ZAD96L | T | V |
ZBD96L | E | G |
ZCD96L | Q | T |
ZDD96L | B | E |
ZED96L | M | R |
ZFD96L | X | C |
ZGD96L | J | P |
ZHD96L | U | A |
ZJD96L | F | M |
ZKD96L | R | Y |
ZLD96L | C | K |
ZMD96L | N | W |
ZND96L | Y | H |
ZPD96L | K | U |
ZQD96L | V | F |
ZRD96L | G | S |
ZSD96L | S | D |
ZTD96L | D | Q |
ZUD96L | P | B |
ZVD96L | A | N |
ZWD96L | L | Z |
ZXD96L | W | L |
ZYD96L | H | X |
ZZD96L | T | J |
You can see that the modulus 23 solution still has a single collision (at ZAD96L and ZZD96L), but this would be a significant improvement on the prior collision issue. The use of modulus 24 but with second factors which are not factors of 24 (14,13,11,10,7,5) has no collisions and fully solves the issue.
Hopefully Te Whatu Ora are able to change this before the new NHI implementation goes live in 2025. If not, then we may have to be exceedingly vigilant with NHI protocols when any manual entry of NHI is done.