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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment