DEV Community


Predictable Pan Card Generation Algorithm.

justhere profile image yas Updated on ・1 min read

In any fintech company in India, an important data point is the user's pan number which is used as primary identification.

A common strategy used in creating test users in such an application is generating a random pan number but one drawback with this approach is any newly generated pan should be checked against the database if it already exists to avoid a collision.

The better way is to serially generate the pan numbers to avoid a collision.

I believe it's an interesting problem of generating Pan Card numbers serially so I wrote an algorithm to do the same which would predictably generate a pan card number for a given number x.

Github: pan-number-generator

This could be used be imported in test cases to generate unique pan numbers and while masking pan data for production dumps.

The series would go as:

Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Editor guide