Skip to main content
Delphix

Algorithm: Repeat First Digit (ZIP-4) (KBA4071)

 

 

KBA

KBA# 4071

At a Glance  

Versions: Applicable to all Delphix Masking versions. 
Description: This algorithm is for 4, 9, and 14 ZIP+4 code (plus-four codes) and repeats the first digit of the 4 last digits and pads with the first number. The rest of the numbers are the same. In the postal system, this extended code is used to identify a geographic segment within the five-digit delivery area.

 

Patterns: This algorithm matches and masks the extended part of the ZIP code. The following patterns are masked: 
  • 4 digit extended code (ZIP is stored in another field).
  • 9 digit ZIP+4 - this masks the 4 extended code leaving ZIP unmasked. 
  • 9 digit ZIP+4 with delimited ('-' or '.') (length 10). 
Characteristics:

Type
Unique
Lookup1
Referential
Integrity2

1:1 Mapping3
Code based n/a Yes  No

1 Unique Lookup - Not applicable. 
2 Referential Integrity - The masked value will be the same between tables, databases, and jobs.
3 1:1 Mapping - The masked value will be mapped uniquely to the input value.

Character 
Encoding:
ASCII Numbers.
Data Types: Works on char, nchar, varchar, nvarchar, int, number etc.
Limitations: * Works only on the US postal codes.

Applicable Delphix Versions

Click here to view the versions of the Delphix engine to which this article applies
Major Release All Sub Releases
All

All

Example

 

The example below shows normal data with numbers with different lengths, then additional values that are unmasked and followed by additional values that are masked.  

ZIP+4 masked 
+----+-----------------+-----------------+
| ID | Orig            | Mask            |
+----+-----------------+-----------------+
| 1  | 1234            | 1111            | << Masked 4: 4 digits - len 4
| 2  |  1234           | 1111            | << Masked 4: 4 digits - len 4
| 3  | 4321            | 4444            | << Masked 4: 4 digits - len 4
| 4  | 123456789       | 123456666       | << Masked 4: 9 digits - len 9
| 5  | 12345-6789      | 12345-6666      | << Masked 4: 9 digits - len 10
| 6  | 12345.6789      | 12345.6666      | << Masked 4: 9 digits - len 10
| 7  | 12345678901234  | 123456666       | << Masked 4: 14 digits - len 14
+----+-----------------+-----------------+

Additional masked
+----+-----------------+-----------------+
| 8  | 12AB56789       | 12AB56666       | << Masked 4: Len 9
| 9  | AB1256789       | AB1256666       | << Masked 4: Len 9
| 10 | -123456789      | -123456666      | << Masked 4: 9 digits - len 10
| 11 | 12AB5678901234  | 12AB56666       | << Masked 4: Len 14
| 12 | AB125678901234  | AB1256666       | << Masked 4: Len 14
| 13 | 123456789AB234  | AB1256666       | << Masked 4: Len 14
| 14 | 123456789012AB  | AB1256666       | << Masked 4: Len 14
+----+-----------------+-----------------+

Unmasked (3 masked examples shown as reference)
+----+-----------------+-----------------+
| 15 | NULL            | NULL            |
| 16 |                 |                 |
| 17 | 1               | 1               |
| 18 | 12              | 12              |
| 19 | 123             | 123             |
| 1  | 1234            | 1111            | << Masked: Len 4
| 20 | 12345           | 12345           |
| 21 | 123456          | 123456          |
| 22 | 1234567         | 1234567         |
| 23 | 12345678        | 12345678        |
| 4  | 123456789       | 123456666       | << Masked: Len 9
| 24 | 1234567890      | 1234567890      |
| 25 | 12345678901     | 12345678901     |
| 26 | 123456789012    | 123456789012    |
| 27 | 1234567890123   | 1234567890123   |
| 8  | 12345678901234  | 123456666       | << Masked: Len 14
| 28 | 123456789012345 | 123456789012345 |
+----+-----------------+-----------------+

Additional unmasked
+----+-----------------+-----------------+
| 29 | ABCD            | ABCD            |
| 30 | 4ABC            | 4ABC            |
| 31 | A123            | A123            |
| 32 | ABCDE           | ABCDE           |
| 33 | 123456789-      | 123456789-      |
+----+-----------------+-----------------+