Skip to main content

nzta-pin.js

NZTA Toll Road account system has an incredibly stupid PIN criteria system for the username & pin sign in. Generate all possible PINs for the NZTA Toll Road account. There are only 725000 valid PINs available.

gist link


const start = new Date();
const characters = 'abcdefghijklnopqrstuvwxyz0123456789';
const valid = new Set();
const invalid = new Set();

for (let a = 0; a < characters.length; a++) {
    for (let b = 0; b < characters.length; b++) {
        for (let c = 0; c < characters.length; c++) {
            for (let d = 0; d < characters.length; d++) {
                const word = characters[a] + characters[b] + characters[c] + characters[d];
                const hasLetter = /[a-z]/.test(word);
                const hasNumber = /[0-9]/.test(word);
                const numberInPosition = /(.\d..)|(..\d.)/.test(word);

                if (hasLetter && hasNumber && numberInPosition) {
                    valid.add(word);
                } else {
                    invalid.add(word);
                }
            }
        }
    }
}

const end = new Date();
const time = (end.getTime() - start.getTime());

console.log({
    valid,
    invalid,
    time: time + 'ms'
});