tokenizepci-dss

Are there any java libraries that can be used to tokenize PANs (Credit Card numbers)?


Are there any opensource java libraries that can be used to tokenize PANs (Credit Card numbers)?

Need the first 6 digits and last 4 digits to be preserved. The tokens generated are short lived. So, need to minimize the chance of any clashes. Just wanted to check whether there is any library available, before starting to write any custom code.


Solution

  • take a look at something like https://gist.github.com/josefeg/5781824

    we wrote our own library to do something like this and it's not complicated. a really simple strategy is to just randomly add the middle digits to the first six and last four and then check if it's luhn valid.