I need to mask credit card numbers. The length of the card numbers is always 16.
For my requirement, I need to keep the first 7 digit so I the credit cart type (VISA, MC, etc) are kept.
I would like to know if there is a masking function that let's me retain the first "x" digits, where "x" is a number and it need to recalculate the check digit.
The masking function would produces unique values as long as the original values are also unique.
Is there any masking function that would work with my requirement?
It needs to work on ZOS, Oracle, SQL SERVER, DB2, etc.
Try using FORMATENCRYPT function in Fast Data Masker.
FORMATENCRYPT doesn't recalculate the check digit. I need a valid card number.
Have you other suggestion who
- generate valide card number - keep the first 7 digit - produces unique values as long as the original values are also unique
There are multiple functions for handling credit cards - look at AMEXCARD, GENCARD, HASHCARD, HASHCARD4, MASTERCARD, VISACARD - please read the DocOps site for specific information for each function: Masking Functions and Parameters - CA Test Data Manager - 4.7 - CA Technologies Documentation
For example, HASHCARD will 'retain the first two digits of the original credit card number (which define the credit card type) and hashes the remaining digits, retaining the original length of the number. This function also ensures that the last digit is the correct check digit for a credit card number. ... If the original number is unique, then it will continue to be unique after the HASHCARD function.'
Also, consider the FORMATLUHN function:
Masking Functions and Parameters - CA Test Data Manager - 4.7 - CA Technologies Documentation - FORMATLUHN
You can set the function to start at character position 8 to keep the first 7 digits, it should then calculate the check-digit as required.
Please let us know if one of these functions meets your needs.
I've tested all of this fonctions on Z/OS :CREDITCARDGENCARDVISACARD
All do not return unique card number for unique original number.
AMEXCARD and MASTERCARD dont work because I need to keep the card type (BIN) of the original number.
HASHCARD works good but they keep only the first 2 digits and I need to keep first 7 digits.
HASHCARD4 are not disponible on Z/OS.
FORMATLUHN doesn’t generate a correct check digit value and the function are not disponible on Z/OS.
I need a function same of HASHCARD, but I can set the function to start at character position 8 to keep the first 7 digits it should then calculate the check-digit as required.
If you really need a function like HASHCARD but need to keep first 7 digits, that would either be an enhancement request (Create an idea in Communities), or custom function as per this discussion here:FDM - Mask Brazil Tax ID:
If these do not satisfy the requirements, I would next look at writing a scalar SQL function and calling it in-line using SQLFUNCTION .
Finally, if needed, you can create your own custom Java function: Create Custom Masking Functions - CA Test Data Manager - 4.7 - CA Technologies Documentation (the existing published functions you mention are effectively productized versions of that same).
If you are looking for detailed support with developing such a custom function, please work with your account team to arrange a conversation on how we can help you directly.