Payment card Primary Account Number masking.  Masking functions provide strict and relaxed masking of Primary Account Numbers. 

• mask_pan()  masks all but the last four digits of the number: 

mysql> SELECT mask_pan(gen_rnd_pan()); +-------------------------+ | mask_pan(gen_rnd_pan()) | +-------------------------+ | XXXXXXXXXXXX2461 | +-------------------------+ 

• mask_pan_relaxed()  is similar but does not mask the first six digits that indicate the payment card issuer unmasked: 

mysql> SELECT mask_pan_relaxed(gen_rnd_pan()); +---------------------------------+ | mask_pan_relaxed(gen_rnd_pan()) | +---------------------------------+ | 770630XXXXXX0807 | +---------------------------------+ 

US Social Security number masking. mask_ssn()  masks all but the last four digits of the number: 

## Generating Random Data with Specific Characteristics 

mysql> SELECT mask_ssn(gen_rnd_ssn()); +-------------------------+ | mask_ssn(gen_rnd_ssn()) | +-------------------------+ | XXX-XX-1723 | +-------------------------+ 

Several functions generate random values. These values can be used for testing, simulation, and so forth. 

gen_range()  returns a random integer selected from a given range: 

mysql> SELECT gen_range(1, 10); +------------------+ | gen_range(1, 10) | +------------------+ | 6 | +------------------+ 

gen_rnd_email()  returns a random email address in the example.com  domain: 

mysql> SELECT gen_rnd_email(); +---------------------------+ | gen_rnd_email() | +---------------------------+ | ayxnq.xmkpvvy@example.com | +---------------------------+ 

gen_rnd_pan()  returns a random payment card Primary Account Number: 

mysql> SELECT gen_rnd_pan(); 

(The gen_rnd_pan()  function result is not shown because its return values should be used only for testing purposes, and not for publication. It cannot be guaranteed the number is not assigned to a legitimate payment account.) 

gen_rnd_ssn()  returns a random US Social Security number with the first and second parts each chosen from a range not used for legitimate numbers: 

