Open topic with navigation
Data masking can be used to protect the privacy of your company and clients’ confidential information, such as credit card, bank account, and social security numbers. DMExpress offers a variety of functions that can be used for masking:
Here we provide examples using the Translate and Substring functions along with the concatenate operator.
In the following example, different techniques are used to mask the Social Security, Phone, and Account numbers, which are presumed to follow a well-defined format.
Note that some of the techniques allow the original data to be restored by reversing the applied operation, while others irreversibly mutate the data.
The Social Security Number (SSN) is translated by applying a defined offset to each of the digits in each part of the SSN. In this example,
This is achieved by using the Substring function to pull out the desired part of the string, and then using the Translate function to replace each digit with its offset value for each SSN part. Then all the translated SSN parts are concatenated (||) along with the hyphens (‘-‘) to derive the translated SSN.
For example, to derive SSNTransPart1, it extracts a 3 character substring starting at position 1, then translates '0' to '1', '1' to '2', ...,'9' to '0'.
SSNTransPart1 = Translate(Substring(RL_Source.SSN,1,3),'0123456789','1234567890')
SSNTransPart2 = Translate(Substring(RL_Source.SSN,5,2),'0123456789','2345678901')
SSNTransPart3 = Translate(Substring(RL_Source.SSN,8,4),'0123456789','3456789012')
SSNTranslated = SSNTransPart1 || '-' || SSNTransPart2 || '-' || SSNTransPart3
The phone number is jumbled by swapping the position of the digits. In this example, the digits in positions 2 & 3 (in red) and 10 & 11 (in blue) are swapped, and the digits in positions 4 & 5 (in orange) and 8 & 9 (in green) are swapped.
This is achieved by using the Substring function to separate out the different segments, and then concatenating all the segments in a different order.
PhoneDigit_1 = Substring(RL_Source.Phone,1,1)
PhoneDigit_2_3 = Substring(RL_Source.Phone,2,2)
PhoneDigit_4_5 = Substring(RL_Source.Phone,4,2)
PhoneDigit_6_7 = Substring(RL_Source.Phone,6,2)
PhoneDigit_8_9 = Substring(RL_Source.Phone,8,2)
PhoneDigit_10_11 = Substring(RL_Source.Phone,10,2)
PhoneDigit_12 = Substring(RL_Source.Phone,12,1)
PhoneJumbled = PhoneDigit_1 || PhoneDigit_10_11 || PhoneDigit_8_9 || PhoneDigit_6_7 || PhoneDigit_4_5 || PhoneDigit_2_3 || PhoneDigit_12
The account number is partially obscured by replacing some of the characters with an "X". In this example, the first two characters and the last three characters are retained as is, and all the intermediate characters except for the hyphens are replaced with an "X".
This is achieved by using the Substring function to pull out the characters to keep, and then concatenating them together with an X-ed out representation of the intermediate characters.
AccountNoBeginning = Substring(RL_Source.AccountNo,1,2)
AccountNoEnding = Substring(RL_Source.AccountNo,12,3)
AccountNoMasked = AccountNoBeginning || '-XXXXX-XX' || AccountNoEnding
163_DataMaskingExample.zip, compatible with DMExpress version 7.5.0 or higher
For additional information on DMExpress functions, see DMExpress functions reference in the DMExpress Help.
Copyright © 2016 Syncsort All rights reserved.