Skip to main content

Using Segment Mapping Algorithm to Mask Credit Card Values (KBA1532)



Masking Credit Card Values

To mask credit card values using an algorithm:

  1. Validate original data. 
    Check for duplicate data in the columns to be masked, unless uniqueness is not a requirement. One way to enforce uniqueness is to create a primary or unique index on the column to be masked.

  1. Configure the environment.
    Create the application, environment, Connector, Rule Set, Inventory for this masking job, if not already configured.
    For more information see Masking Engine User Guide.
  2. Define the Segment Mapping algorithm. 


This example is to mask a 16-digit credit card number.  This example specifies the requirements:

  • first 7 digits and the last digit (16th digit) to be preserved (remain unmasked)
  • no characters to be ignored
  • uniqueness in the masked values

For example:

Original Number Masked Number
5500533005630077 5500533005560437


  1. Navigate to the Masking Menu > Settings tab > Segment Mapping Algorithm 
    To fulfill the requirement in this example, create the algorithm with two segments and do not specify any Min/Max/Range values.
  2. Specify 2 segments:










When taking input (from customers in a web form, for example) you can receive unexpected characters in your data. 

For example, with credit card numbers, people will often add spaces, dashes, or dots between sets of numbers.  If you are not certain of the data in the column, you can use the Ignore Characters field (shown above) to enter a comma separated list of characters that should be skipped over untouched. 

If the unmasked data value was something like "5500-5330-0563-0077" with an ignore characters list of "-, ,." (the hyphen character, the space character, and the period character) and the other definitions shown in this article, the result might look something like "5500-5330-0556-0437".  This preserves the original form with the dashes, the initial 7 digits, the last digit, and then masks the rest.

Since the list is comma separated, it means that you cannot add a comma to the list of ignore characters.  The Ignore comma checkbox allows you the ability to ignore the comma character.

  1.  Create and run the masking job.