Test Data Manager

Expand all | Collapse all

How to mask a credit card

Jump to Best Answer
  • 1.  How to mask a credit card

    Posted 04-17-2019 08:40 AM

    Hello,

     

    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.

     

    Thanks



  • 2.  Re: How to mask a credit card

    Posted 04-17-2019 12:25 PM

    Hello,

     

    Try using FORMATENCRYPT function in Fast Data Masker. 

     

    Thanks,

    NR



  • 3.  Re: How to mask a credit card

    Posted 04-17-2019 12:34 PM

    Hello,

     

    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

     

    Thanks,

     

    Michel



  • 4.  Re: How to mask a credit card
    Best Answer

    Broadcom Employee
    Posted 04-17-2019 01:20 PM

    Hi Michel

     

    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.

     

    Regards,

                Adrian



  • 5.  Re: How to mask a credit card

    Posted 04-23-2019 02:04 PM

    Hi Adrian,


    I've tested all of this fonctions on Z/OS :
    CREDITCARD
    GENCARD
    VISACARD

    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.

     

    Regards,


    Michel



  • 6.  Re: How to mask a credit card

    Broadcom Employee
    Posted 04-24-2019 08:13 AM

    Hi Michel

     

    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.



  • 7.  Re: How to mask a credit card

    Posted 04-23-2019 10:07 AM

    Hi Adrian,


    I've tested all of this fonctions on Z/OS :
    CREDITCARD
    GENCARD
    VISACARD

    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.

     

    Regards,


    Michel