I realize this is a very old thread, but this comes up on Google when looking for the routine, so I'll post an updated answer here.
Inland Revenue has a document which contains the correct algorithm, it can be found here: https://www.ird.govt.nz/resources/d/8/d8e49dce-1bda-4875-8acf-9ebf908c6e17/rwt-nrwt-spec-2014.pdf You need to lookup the Bank being used in this table to find which Algorithm to use... Bank ID, Valid Branch Numbers, Algorithm 01 0001 - 0999, 1100 - 1199, 1800 - 1899 * 02 0001 - 0999, 1200 - 1299 * 03 0001 - 0999, 1300 - 1399, 1500 - 1599, 1700 – 1799 , 1900 - 1999 * 06 0001 - 0999, 1400 - 1499 * 08 6500 - 6599 D 24 4300 - 4349 * 09 0000 E 11 5000 - 6499, 6600 - 8999 * 12 3000 - 3299, 3400 – 3499, 3600 - 3699 * 13 4900 - 4999 * 14 4700 - 4799 * 15 3900 - 3999 * 16 4400 - 4499 * 17 3300 - 3399 * 18 3500 - 3599 * 19 4600 - 4649 * 20 4100 - 4199 * 21 4800 - 4899 * 22 4000 - 4049 * 23 3700 - 3799 * 25 2500 - 2599 F 26 2600 - 2699 G 27 3800 - 3849 * 28 2100 - 2149 G 29 2150 - 2299 G 30 2900 - 2949 * 31 2800 - 2849 X 33 6700 - 6799 F 35 2400 - 2499 * 38 9000 - 9499 * *: If the account base number is below 00990000 then apply algorithm A, otherwise apply algorithm B. And here are the Algorithms Algorithm Bank (2), Branch (4), Account (8), Base Suffix, (4) Modulo A 0 0 6 3 7 9 0 0 10 5 8 4 2 1 0 0 0 0 11 B 0 0 0 0 0 0 0 0 10 5 8 4 2 1 0 0 0 0 11 C 3 7 0 0 0 0 9 1 10 5 3 4 2 1 0 0 0 0 11 D 0 0 0 0 0 0 0 7 6 5 4 3 2 1 0 0 0 0 11 E 0 0 0 0 0 0 0 0 0 0 5 4 3 2 0 0 0 1 11 F 0 0 0 0 0 0 0 1 7 3 1 7 3 1 0 0 0 0 10 G 0 0 0 0 0 0 0 1 3 7 1 3 7 1 0 3 7 1 10 X 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 (There are 8 digits above for Account number, and Algorithm C is the only one which uses the 8th digit. It's not in use apparently. There are 4 digits for suffix) Example: For the bank account number 01-902-0068389-00 algorithm A is to be used for validation. Weighted digits are 0 0 6 3 7 9 0 0 10 5 8 4 2 1 0 0 0 0 (0*0) + (1*0) + (0*6) + (9*3) + (0*7) + (2*9) + (0*0) + (0*0) + (0*10) + (6*5) + (8*8) + (3*4) + (8*2) + (9*1) + (0*0) + (0*0) + (0*0) + (0*0) = 176 176 / 11 = 16, remainder = 0 I hope this helps someone, Mark On Wednesday, 16 May 2007 17:58:59 UTC+12, Olwen Williams wrote: > > I used to know the check digit calculation used to validate bank > accounts, but can't remember it and have not been able to find it > on-line. Can anyone either refresh my memory or point me to some > documentation? > -- -- NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to nzphpug@googlegroups.com To unsubscribe, send email to nzphpug+unsubscr...@googlegroups.com --- You received this message because you are subscribed to the Google Groups "NZ PHP Users Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to nzphpug+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.