Personal information masking policy (standard)

Use the standard personal information masking policy to mask demographic attributes, national identification numbers, phone numbers, and government-issued identifiers across multiple countries.

Parameters

The following parameters are required to configure any personal information masking policy.

Table 1. Personal information masking policy parameters
Parameter Required Type Description
name Yes String The format name. See each format section for the exact value to use.
type Yes String The processor type. Most personal information formats support only RandomFormatFabricationProcessor and RepeatableFormatFabricationProcessor. See each format section for exceptions.
config No Object Pass {} or omit entirely. No configuration properties are supported for any personal information processor.

Ethnicity_CaseSensitive

Masks an ethnicity string by replacing it with a fabricated ethnicity drawn from a dictionary of 227 ethnicity and ethnic group names. The format is case-sensitive — Asian, ASIAN, and asian are treated as distinct inputs and map to different masked values under RepeatableFormatFabricationProcessor. The maximum output length is 22 characters (Other Pacific Islander). Size your target column as VARCHAR(22) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 227 entries in the built-in ethnicity dictionary. Dictionary entries use title case or mixed case.

Example input Note
Asian Single word, title case
Han Chinese Multi-word entry
Other Pacific Islander Longest entry — 22 characters
Beti-Pahuin Hyphenated entry
Zulu Single word
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid ethnicity name is always returned. Under RepeatableFormatFabricationProcessor, the input bytes are hashed with the job IV and the result is unranked to a valid dictionary entry.

Example input Why it is not in the dictionary Engine behavior
asian All lowercase — dictionary stores Asian Returns a valid dictionary entry (input ignored)
ASIAN All uppercase — case mismatch Returns a valid dictionary entry (input ignored)
Native American Not in the dictionary Returns a valid dictionary entry (input ignored)
Mixed Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated ethnicity on every invocation. The output is non-deterministic — the same input produces a different masked ethnicity each time the job runs.

Use when
Masking a standalone ethnicity column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Asian Luba Different random entry
Han Chinese Naga Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated ethnicity. The same input and IV always produce the same output across all runs.

Use when
Masking an ethnicity column that is referenced as a key or used for grouping, where the same source value must consistently map to the same masked value across all related tables and job runs.
Input Output (run 1) Output (run 2)
Asian Pole Pole (same)
Han Chinese Mongol Mongol (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "ethnicity",
  "column_name_target": "ethnicity_masked",
  "masking_properties": {
    "magen_function": {
      "name": "Ethnicity_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "ethnicity",
  "column_name_target": "ethnicity_masked",
  "masking_properties": {
    "magen_function": {
      "name": "Ethnicity_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output. No fabricated value is generated and no error is raised.
Case sensitivity affects the masked value but is not preserved in the output
The masked output is always a dictionary entry in its stored casing. Under RepeatableFormatFabricationProcessor, asian, Asian, and ASIAN are treated as different inputs and map to different masked values.
Fallback values when applied to non-text columns
Applying this format to non-string columns does not raise an error — a fallback value is written silently: 0 for numeric columns, false for boolean, and NULL for timestamp, date, and other non-string types.

EyeColors_CaseSensitive

Masks an eye color string by replacing it with a fabricated eye color drawn from a fixed dictionary of 10 eye color names. The format is case-sensitive. The maximum output length is 14 characters (Red and Violet). Size your target column as VARCHAR(14) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 10 entries in the built-in eye color dictionary. Dictionary entries use title case.

Example input Note
Blue Single word, title case
Gray US spelling — both Gray and Grey are recognized
Grey UK spelling — independent dictionary entry from Gray
Red-Violet Hyphenated entry
Red and Violet Multi-word entry — longest entry at 14 characters
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid eye color is always returned.

Example input Why it is not in the dictionary Engine behavior
blue All lowercase — dictionary stores Blue Returns a valid dictionary entry (input ignored)
BLUE All uppercase — case mismatch Returns a valid dictionary entry (input ignored)
Black Not in the dictionary Returns a valid dictionary entry (input ignored)
Light Brown Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated eye color on every invocation. The output is non-deterministic.

Use when
Masking a standalone eye color column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Blue Red-Violet Different random entry
Hazel Amber Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated eye color. The same input and IV always produce the same output across all runs.

Use when
Masking an eye color column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
Amber Red and Violet Red and Violet (same)
Gray Amber Amber (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "eye_color",
  "column_name_target": "eye_color_masked",
  "masking_properties": {
    "magen_function": {
      "name": "EyeColors_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "eye_color",
  "column_name_target": "eye_color_masked",
  "masking_properties": {
    "magen_function": {
      "name": "EyeColors_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output. No fabricated value is generated and no error is raised.
The three Red compound variants are distinct entries
Red-Violet, Red/Violet, and Red and Violet each map to a different masked value under RepeatableFormatFabricationProcessor. If source data uses these forms inconsistently, masked outputs will differ for what is semantically the same color.
Gray and Grey are independent entries
Each maps to a different masked value under RepeatableFormatFabricationProcessor. Normalize spelling before applying the policy if consistent mapping is required.

Gender_CaseSensitive

Masks a gender string by replacing it with a fabricated gender value drawn from a dictionary of 26 gender identity names. The format is case-sensitive. The maximum output length is 21 characters (Gender non-conforming). Size your target column as VARCHAR(21) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 26 entries in the built-in gender dictionary. The dictionary stores exact casing — entries use title case or mixed case.

Example input Note
Male Single word, title case
Transgender Single word
Gender non-conforming Multi-word — second word lowercase; longest entry at 21 characters
Non-Binary Hyphenated — both words capitalized
Fa'afafine Contains an ASCII apostrophe (U+0027)
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid gender name is always returned.

Example input Why it is not in the dictionary Engine behavior
male All lowercase — dictionary stores Male Returns a valid dictionary entry (input ignored)
MALE All uppercase — case mismatch Returns a valid dictionary entry (input ignored)
Gender Non-Conforming Wrong casing — dictionary stores lowercase non Returns a valid dictionary entry (input ignored)
M Single-character abbreviation — not in the dictionary Returns a valid dictionary entry (input ignored)
F Single-character abbreviation — not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated gender on every invocation. The output is non-deterministic.

Use when
Masking a standalone gender column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Male Bakla Different random entry
Non-Binary Genderfluid Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated gender. The same input and IV always produce the same output across all runs.

Use when
Masking a gender column referenced as a key or used for grouping, where the same source value must consistently map to the same masked value across all related tables and job runs.
Input Output (run 1) Output (run 2)
Male Male Male (same)
Non-Binary Genderqueer Genderqueer (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "gender",
  "column_name_target": "gender_masked",
  "masking_properties": {
    "magen_function": {
      "name": "Gender_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "gender",
  "column_name_target": "gender_masked",
  "masking_properties": {
    "magen_function": {
      "name": "Gender_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output. No fabricated value is generated and no error is raised.
Mixed-case entries require exact internal casing
Gender non-conforming stores a lowercase nGender Non-Conforming is not recognized. Non-Binary capitalizes both words — non-binary and Non-binary are not recognized. Source data must match the exact stored casing.
Common abbreviations are not in the dictionary
M and F are not recognized. They are treated as non-dictionary inputs and receive fabricated values with no relationship to Male or Female.

HairColors_CaseSensitive

Masks a hair color string by replacing it with a fabricated hair color drawn from a dictionary of 16 hair color names. The format is case-sensitive. The maximum output length is 14 characters (White and Gray or White and Grey). Size your target column as VARCHAR(14) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 16 entries in the built-in hair color dictionary. The dictionary stores exact casing.

Example input Note
Black Single word, title case
Grey UK spelling — independent entry from Gray
Gray US spelling — independent entry from Grey
White-Grey Hyphenated — both words capitalized
White and Gray Multi-word — lowercase and; tied longest at 14 characters
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid hair color is always returned.

Example input Why it is not in the dictionary Engine behavior
black All lowercase — dictionary stores Black Returns a valid dictionary entry (input ignored)
White And Gray Wrong internal casing — dictionary stores lowercase and Returns a valid dictionary entry (input ignored)
Dark Brown Not in the dictionary Returns a valid dictionary entry (input ignored)
Silver Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated hair color on every invocation. The output is non-deterministic.

Use when
Masking a standalone hair color column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Black White/Grey Different random entry
Auburn Blonde Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated hair color. The same input and IV always produce the same output across all runs.

Use when
Masking a hair color column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
Black Black Black (same)
Auburn Blond Blond (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "hair_color",
  "column_name_target": "hair_color_masked",
  "masking_properties": {
    "magen_function": {
      "name": "HairColors_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "hair_color",
  "column_name_target": "hair_color_masked",
  "masking_properties": {
    "magen_function": {
      "name": "HairColors_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output. No fabricated value is generated and no error is raised.
Compound White entries require exact separator and casing
The six White compound variants differ by separator (-, /, and ) and spelling (Grey/Gray). White-grey (lowercase second word) does not match White-Grey, and White And Gray (capitalized And) does not match White and Gray. Source data must use the exact stored form.
Blond and Blonde are distinct entries
Each maps to a different masked value under RepeatableFormatFabricationProcessor. Similarly, Gray and Grey are independent entries. Normalize before applying if consistent mapping is required.

LanguageCodes

Masks a language code by replacing it with a fabricated or tokenized code from the same set of approximately 200 BCP 47/ISO 639 language codes. All 4 standard processors are supported. The maximum output length is 6 characters (simple). All stored codes are lowercase. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Valid input values
Example input Note
en English — 2-character code, lowercase
fr French
de German
zh Chinese
simple Longest entry — 6 characters
aa Rank-0 entry (first in sorted order)
Invalid input values

Behavior differs by processor. Redaction and tokenization raise an exception for invalid inputs; fabrication processors silently return a valid code.

Value Reason FormatPreservingRedactionProcessor FormatPreservingTokenizationProcessor RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
EN Uppercase — set stores en IllegalArgumentException MagenPayloadException Silently returns a valid code Silently returns a deterministic valid code
English Full language name — not in the set IllegalArgumentException MagenPayloadException Silently returns a valid code Silently returns a deterministic valid code
en-US BCP 47 locale tag with region — not in the set IllegalArgumentException MagenPayloadException Silently returns a valid code Silently returns a deterministic valid code
(empty string) No content to parse IllegalArgumentException MagenPayloadException Silently returns a valid code Silently returns a deterministic valid code
Processors
FormatPreservingRedactionProcessor

Replaces any valid language code with aa — the rank-0 element of the set. All valid codes collapse to the same output. No IV is required.

Use when
The requirement is to remove the language code entirely and replace it with a fixed placeholder. All original codes collapse to aa.
Input Output
en aa
fr aa
simple aa
FormatPreservingTokenizationProcessor

Maps each valid code to a deterministic token that is also a valid set member. The mapping is reversible with the same IV.

Use when
The language code must be masked in a way that can be reversed by an authorized process, and the same source code must always produce the same token.
Input Output
en et
fr mwl
de gan
simple bn
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated code. Both valid and invalid inputs return a valid code — invalid inputs are not rejected.

Use when
Masking a language code column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
en et et (same)
fr mwl mwl (same)
RandomFormatFabricationProcessor

Generates a non-deterministic fabricated code on every invocation.

Use when
Masking a standalone language code column where referential consistency across runs is not required.
Input Output (run 1) Output (run 2)
en vi Different random code
fr ka Different random code
Configuration examples
FormatPreservingRedactionProcessor
{
  "column_name_source": "language_code",
  "column_name_target": "language_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageCodes",
      "type": "FormatPreservingRedactionProcessor",
      "config": {}
    }
  }
}
FormatPreservingTokenizationProcessor
{
  "column_name_source": "language_code",
  "column_name_target": "language_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageCodes",
      "type": "FormatPreservingTokenizationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "language_code",
  "column_name_target": "language_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageCodes",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
RandomFormatFabricationProcessor
{
  "column_name_source": "language_code",
  "column_name_target": "language_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageCodes",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output for all four processors.
Redaction and tokenization raise exceptions for invalid inputs
FormatPreservingRedactionProcessor raises IllegalArgumentException; FormatPreservingTokenizationProcessor raises MagenPayloadException. Apply these processors only to columns containing valid lowercase set members. The fabrication processors handle invalid inputs gracefully.
Redaction always produces aa — every row receives the same value
Use tokenization or fabrication if per-code distinction must be preserved.
All codes are lowercase — uppercase variants are invalid
EN, Fr, and similar mixed-case forms are not in the set. Normalize input to lowercase before applying redaction or tokenization.

LanguageList_CaseSensitive

Masks a language string by replacing it with a fabricated entry drawn from a rich multilingual dictionary of 1,321 entries. The dictionary covers full English names, native-script names, ISO 639-1 codes, ISO 639-3 codes, dialect names, and language family codes. The maximum output length is 37 characters. Apply to VARCHAR(37) or wider, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 1,321 entries. The format is case-sensitive — English, english, and ENGLISH are each treated as distinct values. ISO codes are stored in lowercase.

Example input Note
English Full name, title case
en ISO 639-1 code, lowercase
eng ISO 639-3 code, lowercase
Deutsch Native-script name
Egyptian Arabic Multi-word dialect name
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid dictionary entry is always returned.

Example input Why it is not in the dictionary Engine behavior
english All lowercase — dictionary stores English Returns a valid dictionary entry (input ignored)
EN Uppercase ISO code — dictionary stores en Returns a valid dictionary entry (input ignored)
Simplified Chinese Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated dictionary entry on every invocation. The output is non-deterministic.

Use when
Masking a standalone language column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
English North Ndebele Different random entry
en ces Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated entry. The same input and IV always produce the same output across all runs.

Use when
Masking a language column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
English Libyan Arabic Libyan Arabic (same)
French Huizhou Huizhou (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "language",
  "column_name_target": "language_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageList_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "language",
  "column_name_target": "language_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageList_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
ISO codes are stored in lowercase — uppercase variants are not recognized
EN and ENG are treated as non-dictionary inputs and receive different masked values than en and eng.
The same language appears under multiple distinct entries
English is represented by English, en, and eng. Under RepeatableFormatFabricationProcessor, each maps to a different output. Ensure the source column uses a single consistent representation.
The output may be any form from the dictionary
A masked value may be an ISO code, a full name, a native-script string, or a dialect name. If the target column must contain only one type of entry, this format is not suitable.

LanguageNames

Masks a language name string by replacing it with a fabricated name drawn from a set of 260 English language names. The maximum output length is 15 characters (be-x-Belarusian). Size your target column as VARCHAR(15) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 260 entries. The format is case-sensitive. Prefixed entries use lowercase prefixes and title-cased suffixes.

Example input Note
English Single word, title case
bat-Samogitian Lowercase prefix + hyphen + title case suffix
be-x-Belarusian Double-hyphen prefix variant — longest entry at 15 characters
Simple Stub name for Simple English
Non-dictionary inputs

Any string that does not exactly match a set entry is processed without error — a valid entry is always returned.

Example input Why it is not in the set Engine behavior
english All lowercase — set stores English Returns a valid set entry (input ignored)
bat-samogitian Lowercase suffix — set stores bat-Samogitian Returns a valid set entry (input ignored)
Mandarin Chinese Not in the set Returns a valid set entry (input ignored)
(empty string) No content to look up Returns a valid set entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated language name on every invocation. The output is non-deterministic.

Use when
Masking a standalone language name column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
English Albanian Different random entry
zh-Classical Low Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated language name. The same input and IV always produce the same output across all runs.

Use when
Masking a language name column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
English Galician Galician (same)
French Esperanto Esperanto (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "language_name",
  "column_name_target": "language_name_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageNames",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "language_name",
  "column_name_target": "language_name_masked",
  "masking_properties": {
    "magen_function": {
      "name": "LanguageNames",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Prefixed entries require exact casing of both prefix and suffix
Entries such as bat-Samogitian, zh-Classical, and be-x-Belarusian store lowercase prefixes and title-cased suffixes. Bat-Samogitian (capital B) and bat-samogitian (all lowercase) are not recognized.

MaritalStatus_CaseSensitive

Masks a marital status string by replacing it with a fabricated marital status drawn from a dictionary of 8 entries. The format is case-sensitive. The maximum output length is 23 characters (Surviving Civil Partner). Size your target column as VARCHAR(23) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 8 entries. All entries are title-cased.

Example input Note
Married Single word, title case
Single Single word
Civil Partner Two words, both capitalized
Surviving Civil Partner Three words, all capitalized — longest entry at 23 characters
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid dictionary entry is always returned.

Example input Why it is not in the dictionary Engine behavior
married All lowercase — dictionary stores Married Returns a valid dictionary entry (input ignored)
Civil partner Second word not capitalized Returns a valid dictionary entry (input ignored)
Unmarried Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated marital status on every invocation. The output is non-deterministic.

Use when
Masking a standalone marital status column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Single Civil Partner Different random entry
Widowed Separated Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated marital status. The same input and IV always produce the same output across all runs.

Use when
Masking a marital status column shared across related tables where the same source value must consistently map to the same masked value.
Input Output (run 1) Output (run 2)
Single Single Single (same)
Widowed Separated Separated (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "marital_status",
  "column_name_target": "marital_status_masked",
  "masking_properties": {
    "magen_function": {
      "name": "MaritalStatus_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "marital_status",
  "column_name_target": "marital_status_masked",
  "masking_properties": {
    "magen_function": {
      "name": "MaritalStatus_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Multi-word entries require all words capitalized
Civil Partner and Surviving Civil Partner store each word in title case. Variants such as Civil partner and civil partner are not recognized and are treated as non-dictionary inputs.
Small domain size — only 8 entries
With only 8 possible output values, the masked data has low cardinality. Under RepeatableFormatFabricationProcessor, multiple distinct inputs frequently map to the same masked status.

NorthAmericaPhone

Masks a North American phone number by replacing it with a fabricated or tokenized phone number that preserves the original formatting structure. All 4 standard processors are supported. The maximum output length is 14 characters. Apply to VARCHAR(14) or wider, TEXT, or CHAR(n) columns only.

The format accepts 14 layout variants covering plain digits, hyphen, dot, space, and parenthesized area code combinations. The following table lists the accepted format variants.

Table 2. Accepted NorthAmericaPhone format variants
Pattern Example
xxxxxxxxxx (plain 10 digits) 5551231234
xxx-xxx-xxxx 555-123-4567
xxx.xxx.xxxx 555.123.4567
xxx xxx xxxx 555 123 4567
(xxx)xxxxxxx (416)5551234
(xxx)xxx-xxxx (416)555-1234
(xxx)xxx.xxxx (416)555.1234
(xxx)xxx xxxx (416)555 1234
(xxx).xxx.xxxx (416).555.1234
(xxx)-xxx-xxxx (416)-555-1234
(xxx) xxxxxxx (416) 5551234
(xxx) xxx-xxxx (416) 555-1234
(xxx) xxx.xxxx (416) 555.1234
(xxx) xxx xxxx (416) 555 1234
Valid input values
Example input Note
5551231234 Plain 10 digits, no separator
555-123-4567 Hyphen separator
555.123.4567 Dot separator
(416)555-1234 Parenthesized area code, hyphen separator
(416) 555-1234 Parenthesized area code, space after paren, hyphen separator
Invalid input values

Behavior differs by processor. Redaction and tokenization raise exceptions; fabrication processors silently return a valid phone number.

Value Reason FormatPreservingRedactionProcessor FormatPreservingTokenizationProcessor RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
+1-555-123-4567 International +1 prefix not supported IllegalArgumentException MagenPayloadException Silently returns a valid phone number Silently returns a deterministic valid phone number
1-800-555-1234 Leading country code digit IllegalArgumentException MagenPayloadException Silently returns a valid phone number Silently returns a deterministic valid phone number
55-1234-5678 Area code has only 2 digits IllegalArgumentException MagenPayloadException Silently returns a valid phone number Silently returns a deterministic valid phone number
(empty string) No content to parse IllegalArgumentException MagenPayloadException Silently returns a valid phone number Silently returns a deterministic valid phone number
Processors
FormatPreservingRedactionProcessor

Replaces every digit in the phone number with 0. All separators, parentheses, spaces, and dots are preserved in their original positions.

Use when
The phone number must be fully suppressed but the column format must be preserved for downstream schema compatibility.
Input Output
555-123-4567 000-000-0000
(416) 555-1234 (000) 000-0000
5551231234 0000000000
FormatPreservingTokenizationProcessor

Replaces each digit group with an IV-derived token. Separators, parentheses, and structural punctuation are preserved exactly. The same input and IV always produce the same token.

Use when
Phone numbers must be consistently pseudonymized across systems so that the same source number always produces the same token, enabling cross-table joins without exposing the real number.
Input Output
555-123-4567 941-173-1243
555.123.4567 941.173.1243
(416) 555-1234 (431) 773-1860
RepeatableFormatFabricationProcessor

Generates a deterministic fabricated phone number. Both valid and invalid inputs produce a valid phone number.

Use when
Phone number columns appear in related tables and the same source value must consistently map to the same masked value for joins and reporting.
Input Output (run 1) Output (run 2)
555-123-4567 560-141-5860 560-141-5860 (same)
(416) 555-1234 (025) 875-8823 (025) 875-8823 (same)
RandomFormatFabricationProcessor

Generates a non-deterministic fabricated phone number on every invocation.

Use when
Masking a standalone phone column where referential consistency across runs is not required.
Input Output (run 1) Output (run 2)
555-123-4567 435-891-1177 Different random phone
Configuration examples
FormatPreservingRedactionProcessor
{
  "column_name_source": "phone",
  "column_name_target": "phone_masked",
  "masking_properties": {
    "magen_function": {
      "name": "NorthAmericaPhone",
      "type": "FormatPreservingRedactionProcessor",
      "config": {}
    }
  }
}
FormatPreservingTokenizationProcessor
{
  "column_name_source": "phone",
  "column_name_target": "phone_masked",
  "masking_properties": {
    "magen_function": {
      "name": "NorthAmericaPhone",
      "type": "FormatPreservingTokenizationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "phone",
  "column_name_target": "phone_masked",
  "masking_properties": {
    "magen_function": {
      "name": "NorthAmericaPhone",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
RandomFormatFabricationProcessor
{
  "column_name_source": "phone",
  "column_name_target": "phone_masked",
  "masking_properties": {
    "magen_function": {
      "name": "NorthAmericaPhone",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output for all four processors.
Country code and international prefixes are not supported
+1-555-123-4567 and 1-800-555-1234 are invalid. Strip any leading country code before applying the policy.
Redaction and tokenization raise exceptions for invalid inputs
FormatPreservingRedactionProcessor raises IllegalArgumentException; FormatPreservingTokenizationProcessor raises MagenPayloadException. The fabrication processors handle invalid inputs gracefully.
Redaction always produces all-zero digits
All digits become 0. Use tokenization if per-row distinctness must be preserved while still suppressing the real number.

SexualOrientation_CaseSensitive

Masks a sexual orientation string by replacing it with a fabricated value drawn from a dictionary of 33 sexual orientation and romantic identity terms. The format is case-sensitive. The maximum output length is 17 characters (Libidoist asexual). Size your target column as VARCHAR(17) or wider. Apply to VARCHAR, TEXT, or CHAR(n) columns only.

Dictionary inputs

A dictionary input is a string that exactly matches one of the 33 entries. Most entries are title case; Libidoist asexual has only the first word capitalized.

Example input Note
Bisexual Single word, title case
Gay Single word
Pansexual Single word
Libidoist asexual Multi-word — only first word capitalized; longest entry at 17 characters
Non-dictionary inputs

Any string that does not exactly match a dictionary entry is processed without error — a valid dictionary entry is always returned.

Example input Why it is not in the dictionary Engine behavior
bisexual All lowercase — dictionary stores Bisexual Returns a valid dictionary entry (input ignored)
Libidoist Asexual Both words capitalized — dictionary stores lowercase asexual Returns a valid dictionary entry (input ignored)
Straight Not in the dictionary Returns a valid dictionary entry (input ignored)
(empty string) No content to look up Returns a valid dictionary entry (input ignored)
Processors
RandomFormatFabricationProcessor

Generates a new fabricated value on every invocation. The output is non-deterministic.

Use when
Masking a standalone sexual orientation column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
Bisexual Autosexual Different random entry
Libidoist asexual Spectrasexual Different random entry
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated value. The same input and IV always produce the same output across all runs.

Use when
Masking a sexual orientation column referenced as a key or used for grouping, where the same source value must consistently map to the same masked value across all related tables and job runs.
Input Output (run 1) Output (run 2)
Bisexual Multisexual Multisexual (same)
Libidoist asexual Bicurious Bicurious (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "sexual_orientation",
  "column_name_target": "sexual_orientation_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SexualOrientation_CaseSensitive",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "sexual_orientation",
  "column_name_target": "sexual_orientation_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SexualOrientation_CaseSensitive",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Libidoist asexual uses mixed capitalization
Unlike all other entries, which are fully title-cased, Libidoist asexual has a lowercase second word. Libidoist Asexual (both words capitalized) is not in the dictionary and is treated as a non-dictionary input.

UsaSocialSecurityNumber

Masks a US Social Security Number (SSN) by replacing it with a fabricated SSN that satisfies all structural constraints. The output always preserves the separator style of the input and is a structurally valid SSN. The maximum output length is 11 characters. Apply to VARCHAR(11), CHAR(11), or TEXT columns only.

The format accepts 3 separator variants. The following table shows the accepted patterns and the SSN digit constraints enforced on all fabricated outputs.

Table 3. UsaSocialSecurityNumber digit constraints
Group Valid range Forbidden values
Area (AAA) 001665 and 667899 000, 666, 900999
Group (GG) 0199 00
Serial (SSSS) 00019999 0000
Valid input values
Example input Note
123-45-6789 Hyphen separator
123 45 6789 Space separator
123456789 No separator (plain 9 digits)
001-01-0001 Minimum valid values
Invalid input values

Both fabrication processors silently fabricate a new valid SSN for invalid inputs — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
000-45-6789 Area 000 is forbidden Returns a random valid SSN Returns a deterministic valid SSN
666-45-6789 Area 666 is forbidden Returns a random valid SSN Returns a deterministic valid SSN
123-00-6789 Group 00 is forbidden Returns a random valid SSN Returns a deterministic valid SSN
123-45-0000 Serial 0000 is forbidden Returns a random valid SSN Returns a deterministic valid SSN
123.45.6789 Dot separator not supported Returns a random valid SSN Returns a deterministic valid SSN
(empty string) No content to parse Returns a random valid SSN Returns a deterministic valid SSN
Processors
RandomFormatFabricationProcessor

Generates a new fabricated SSN on every invocation. The output is non-deterministic.

Use when
Masking an SSN column where referential consistency across rows or job runs is not required — for example, a standalone identifier in a single-table export.
Input Output (run 1) Output (run 2)
123-45-6789 059-92-6675 Different random SSN
123456789 341935762 Different random SSN
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated SSN. The same input and IV always produce the same output across all runs. The output preserves the separator style of valid inputs.

Use when
Masking an SSN column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
123-45-6789 009-33-3254 009-33-3254 (same)
123456789 009333254 009333254 (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "ssn",
  "column_name_target": "ssn_masked",
  "masking_properties": {
    "magen_function": {
      "name": "UsaSocialSecurityNumber",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "ssn",
  "column_name_target": "ssn_masked",
  "masking_properties": {
    "magen_function": {
      "name": "UsaSocialSecurityNumber",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Forbidden area, group, and serial values are treated as invalid
SSNs containing area 000, 666, or 900999; group 00; or serial 0000 are not structurally valid and receive a fabricated replacement with no relationship to the original.
Output format variant is not guaranteed to match input for invalid inputs
Valid inputs consistently receive output in the same separator style (hyphen in → hyphen out). Invalid inputs may produce output in any of the three variants.

VehicleIdentificationNumber

Masks a Vehicle Identification Number (VIN) by replacing it with a fabricated or tokenized VIN that satisfies the 17-character alphanumeric structure. All 4 standard processors are supported. The output is always exactly 17 characters. Apply to VARCHAR(17), CHAR(17), or TEXT columns only.

The format validates against the regex [A-HJ-NPR-Z0-9]{17}. The letters I, O, and Q are excluded from the valid character set. All letters must be uppercase.

Valid input values
Example input Note
1HGCM82633A004352 Typical North American VIN
JH4KA7660NC024816 Japanese manufacturer VIN
WAUZZZ4G4DN092842 European manufacturer VIN
12345678901234567 All digits, 17 characters
ZZZZZZZZZZZZZZZZZ All Z, valid charset upper bound
Invalid input values

Behavior differs by processor. Redaction and tokenization raise exceptions; fabrication processors silently return a valid VIN.

Value Reason FormatPreservingRedactionProcessor FormatPreservingTokenizationProcessor RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
1HGCM826I3A004352 Contains I (excluded letter) IllegalArgumentException MagenPayloadException Silently returns a valid VIN Silently returns a deterministic valid VIN
1HGCM82633A00435 Only 16 characters IllegalArgumentException MagenPayloadException Silently returns a valid VIN Silently returns a deterministic valid VIN
1hgcm82633a004352 Lowercase letters IllegalArgumentException MagenPayloadException Silently returns a valid VIN Silently returns a deterministic valid VIN
(empty string) No content to parse IllegalArgumentException MagenPayloadException Silently returns a valid VIN Silently returns a deterministic valid VIN
Processors
FormatPreservingRedactionProcessor

Replaces the entire VIN with 00000000000000000 (17 zeros) — the rank-0 element of the [A-HJ-NPR-Z0-9]{17} domain.

Use when
VIN data must be fully suppressed but the column length (17 characters) must be preserved for downstream schema compatibility.
Input Output
1HGCM82633A004352 00000000000000000
ZZZZZZZZZZZZZZZZZ 00000000000000000
FormatPreservingTokenizationProcessor

Replaces each character with an IV-derived character from the same charset, preserving the 17-character length exactly. The same input and IV always produce the same token. The tokenized VIN is structurally indistinguishable from a real VIN.

Use when
VINs must be consistently pseudonymized across systems — the same source VIN always produces the same token, enabling cross-table joins without exposing the real VIN.
Input Output
1HGCM82633A004352 T2UE492E13MA42GLR
JH4KA7660NC024816 M2X5F953RTBYMGKDG
ZZZZZZZZZZZZZZZZZ ATVNUMBF36XC3KUNB
RepeatableFormatFabricationProcessor

Generates a deterministic fabricated VIN. Both valid and invalid inputs produce a valid VIN.

Use when
VIN columns appear in related tables and the same source value must consistently map to the same masked value for joins and reporting.
Input Output (run 1) Output (run 2)
1HGCM82633A004352 T2UE492E13MA42GLR T2UE492E13MA42GLR (same)
WAUZZZ4G4DN092842 58KASZJ510211LA5Z 58KASZJ510211LA5Z (same)
RandomFormatFabricationProcessor

Generates a non-deterministic fabricated VIN on every invocation.

Use when
Masking a standalone VIN column where referential consistency across runs is not required.
Input Output (run 1) Output (run 2)
1HGCM82633A004352 SCF9Z3VEZLFCY1L4J Different random VIN
Configuration examples
FormatPreservingRedactionProcessor
{
  "column_name_source": "vin",
  "column_name_target": "vin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "VehicleIdentificationNumber",
      "type": "FormatPreservingRedactionProcessor",
      "config": {}
    }
  }
}
FormatPreservingTokenizationProcessor
{
  "column_name_source": "vin",
  "column_name_target": "vin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "VehicleIdentificationNumber",
      "type": "FormatPreservingTokenizationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "vin",
  "column_name_target": "vin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "VehicleIdentificationNumber",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
RandomFormatFabricationProcessor
{
  "column_name_source": "vin",
  "column_name_target": "vin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "VehicleIdentificationNumber",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output for all four processors.
The letters I, O, and Q are forbidden
A VIN containing I, O, or Q — in any case — is invalid. Normalize source data to uppercase and strip any forbidden characters before applying redaction or tokenization.
Redaction and tokenization raise exceptions for invalid inputs
FormatPreservingRedactionProcessor raises IllegalArgumentException; FormatPreservingTokenizationProcessor raises MagenPayloadException. The fabrication processors handle invalid inputs gracefully.
Redaction always produces 00000000000000000
Every row receives the same value after redaction. Use tokenization if per-row distinctness must be preserved while still suppressing the real VIN.

CanadianSIN

Masks a Canadian Social Insurance Number (SIN) by replacing it with a fabricated SIN that satisfies the 9-digit Luhn-validated structure. The output always preserves the separator style of the input and is a structurally correct, Luhn-valid SIN. The maximum output length is 11 characters. Apply to VARCHAR(11), CHAR(11), or TEXT columns only.

Each of the two separator slots is independently optional — it can be a hyphen (-), a space ( ), or absent. The following table shows the accepted format variants.

Table 4. Accepted CanadianSIN format variants
Pattern Example
XXXXXXXXX (no separators) 046454286
XXX-XXX-XXX 046-454-286
XXX XXX XXX 046 454 286
XXX-XXXXXX 046-454286
XXXXXXX-XXX 046454-286
XXX-XXX XXX 046-454 286
XXX XXX-XXX 046 454-286
Valid input values
Example input Note
046454286 Plain 9 digits, Luhn-valid
046-454-286 Uniform hyphen separators
046 454 286 Uniform space separators
046-454 286 Mixed separators — valid
Invalid input values

Both fabrication processors silently fabricate a new valid SIN for invalid inputs — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
046454287 Invalid Luhn check digit (correct digit is 6) Returns a random valid SIN Returns a deterministic valid SIN
04645428 Only 8 digits Returns a random valid SIN Returns a deterministic valid SIN
046.454.286 Dot separator — not supported Returns a random valid SIN Returns a deterministic valid SIN
(empty string) No content to parse Returns a random valid SIN Returns a deterministic valid SIN
Processors
RandomFormatFabricationProcessor

Generates a new fabricated SIN on every invocation. The output is non-deterministic.

Use when
Masking a SIN column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
046454286 232406090 Different random SIN
046-454-286 714-876-844 Different random SIN
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated SIN. The same input and IV always produce the same output across all runs.

Use when
Masking a SIN column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
046454286 639840545 639840545 (same)
046-454-286 639-840-545 639-840-545 (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "sin",
  "column_name_target": "sin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "CanadianSIN",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "sin",
  "column_name_target": "sin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "CanadianSIN",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
The Luhn check digit is strictly validated
A SIN with an incorrect check digit (for example, 046454287 instead of 046454286) is treated as invalid and receives a fabricated replacement with no semantic relationship to the original.
Output separator style is not guaranteed to match the input
The fabrication engine can produce output in any of the 9 separator combinations regardless of the input style. Under RepeatableFormatFabricationProcessor the separator style is deterministic for the given input and IV but may differ from the source.

FrenchINSEE

Masks a French INSEE number (numéro de Sécurité Sociale) by replacing it with a fabricated INSEE number that satisfies all structural constraints including the modulo-97 control key. The output is always a valid, correctly keyed 16-character INSEE number. Apply to VARCHAR(16), CHAR(16), or TEXT columns only.

The INSEE number encodes personal identity information in a fixed structure. The following table describes each field.

Table 5. FrenchINSEE field structure
Position Field Values Description
1 Gender (s) 1 or 2 1 = male (permanent), 2 = female (permanent)
2–3 Birth year (yy) 0099 Last two digits of birth year
4–5 Birth month (mm) 0112 Month of birth
6–10 Location code (lllll) 5 digits COG (Code Officiel Géographique) — département + commune
11–13 Order number (ooo) 3 digits Sequence within same birth place/year/month
14 Separator (space) Always a literal space
15–16 Control key (kk) 0197 97 − (body mod 97), zero-padded
Valid input values
Example input Note
1930612345678 12 Male, born June 1993, control key 12
2850312345001 97 Female, born March 1985, control key 97
Invalid input values

Both fabrication processors silently fabricate a new valid INSEE number — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
0930612345678 12 Gender 0 — only 1 or 2 allowed Returns a random valid INSEE number Returns a deterministic valid INSEE number
1930012345678 12 Month 00 — forbidden Returns a random valid INSEE number Returns a deterministic valid INSEE number
1930612345678 11 Wrong control key (correct key is 12) Returns a random valid INSEE number Returns a deterministic valid INSEE number
1930612345678-12 Hyphen instead of space before control key Returns a random valid INSEE number Returns a deterministic valid INSEE number
(empty string) No content to parse Returns a random valid INSEE number Returns a deterministic valid INSEE number
Processors
RandomFormatFabricationProcessor

Generates a new fabricated INSEE number on every invocation. The output is non-deterministic.

Use when
Masking an INSEE column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
1930612345678 12 1391155479715 75 Different random INSEE number
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated INSEE number. The same input and IV always produce the same output across all runs.

Use when
Masking an INSEE column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
1930612345678 12 2380788814739 06 2380788814739 06 (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "insee_number",
  "column_name_target": "insee_number_masked",
  "masking_properties": {
    "magen_function": {
      "name": "FrenchINSEE",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "insee_number",
  "column_name_target": "insee_number_masked",
  "masking_properties": {
    "magen_function": {
      "name": "FrenchINSEE",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Control key is strictly validated
An INSEE number with an incorrect control key is treated as invalid and receives a fabricated replacement with no semantic relationship to the original.
Gender encoding is limited to 1 and 2
The format only encodes binary gender (1 = male, 2 = female). Source data using other conventions (for example, 3 for non-binary) is treated as invalid.
The output always uses the compact body format
Regardless of how the source INSEE is formatted, the fabricated output is always in the compact form: 13 unspaced digits, one space, and the 2-digit control key. Internal grouping spaces in the source are not reproduced.

ItalianFiscalCode

Masks an Italian Fiscal Code (Codice Fiscale) by replacing it with a fabricated code that satisfies all structural constraints including the check letter. The output is always a valid, correctly keyed 16-character fiscal code. Apply to VARCHAR(16), CHAR(16), or TEXT columns only. All letters must be uppercase.

The fiscal code encodes personal identity information in a fixed 16-character alphanumeric structure. The following table describes each field.

Table 6. ItalianFiscalCode field structure
Positions Field Format Description
1–3 Surname code [A-Z]{3} Three uppercase letters derived from surname consonants/vowels
4–6 First name code [A-Z]{3} Three uppercase letters derived from first name consonants/vowels
7–8 Birth year \d{2} Last two digits of birth year (0099)
9 Birth month [ABCDEHLMPRST] One letter: A=Jan, B=Feb, C=Mar, D=Apr, E=May, H=Jun, L=Jul, M=Aug, P=Sep, R=Oct, S=Nov, T=Dec
10–11 Birth day + gender \d{2} 0131 for male; 4171 for female (day + 40)
12–15 Town code 1 letter + 3-char code Code from Italian town/country dictionary (~10,000 codes)
16 Check letter [A-Z] Computed: odd/even weighted sum of positions 1–15, mod 26 → A + remainder
Valid input values
Example input Note
MRTMTT25D09F205Z Reference example — surname MRT, first name MTT, month D (April), town F205, check Z
RSSMRA85M01H501U Male, born January 1985, Rome (H501)
MRNGLA70A41F205O Female, born January 1970, day 41 (1st day)
Invalid input values

Both fabrication processors silently fabricate a new valid fiscal code — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
mRTMTT25D09F205Z Lowercase letter in surname Returns a random valid fiscal code Returns a deterministic valid fiscal code
MRTMTT25I09F205Z I is not in the valid month set {ABCDEHLMPRST} Returns a random valid fiscal code Returns a deterministic valid fiscal code
MRTMTT25D09F205A Incorrect check letter (correct is Z) Returns a random valid fiscal code Returns a deterministic valid fiscal code
MRTMTT25D09F205 Only 15 characters — missing check letter Returns a random valid fiscal code Returns a deterministic valid fiscal code
(empty string) No content to parse Returns a random valid fiscal code Returns a deterministic valid fiscal code
Processors
RandomFormatFabricationProcessor

Generates a new fabricated fiscal code on every invocation. The output is non-deterministic.

Use when
Masking a fiscal code column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
MRTMTT25D09F205Z VVYTAH18B04B048U Different random code
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated fiscal code. The same input and IV always produce the same output across all runs.

Use when
Masking a fiscal code column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
MRTMTT25D09F205Z NENBGX93A07B083M NENBGX93A07B083M (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "fiscal_code",
  "column_name_target": "fiscal_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "ItalianFiscalCode",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "fiscal_code",
  "column_name_target": "fiscal_code_masked",
  "masking_properties": {
    "magen_function": {
      "name": "ItalianFiscalCode",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
The check letter is strictly validated
A code with valid structure but an incorrect check letter is treated as invalid and receives a fabricated replacement with no relationship to the original.
All letters must be uppercase
Any lowercase character anywhere in the input makes it invalid. Under RepeatableFormatFabricationProcessor a lowercase variant maps to a different output than its uppercase equivalent.
Day range 32–40 is forbidden for both genders
Male days run 0131; female days run 4171. The values 3240 are invalid for both.
Month letter must be one of {ABCDEHLMPRST}
Only the 12 letters A B C D E H L M P R S T are accepted for the month field. Any other letter in position 9 makes the input invalid.

SpanishNIF

Masks a Spanish National Identification Number (NIF/NIE) by replacing it with a fabricated number that satisfies all structural constraints including the computed check character. The output is always a valid, correctly keyed 9-character NIF. Apply to VARCHAR(9), CHAR(9), or TEXT columns only.

The first character is a digit 09 (standard DNI) or one of X, Y, Z (NIE for foreign residents). The check character is the result of numeric_body % 23 indexed into TRWAGMYFPDXBNJZSQVHLCKE. The letters I, O, and U are not valid check characters.

Valid input values
Example input Note
12345678Z Standard DNI — correct check
X1234567L NIE starting with X — correct check
Y1234567X NIE starting with Y — correct check
Z9999999W NIE starting with Z — correct check
Invalid input values

Both fabrication processors silently fabricate a new valid NIF — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
12345678A A is not the correct check for body 12345678 Returns a random valid NIF Returns a deterministic valid NIF
A1234567Z A is not in the valid first-character set [0-9XYZ] Returns a random valid NIF Returns a deterministic valid NIF
12345678I I is not a valid check character Returns a random valid NIF Returns a deterministic valid NIF
1234567Z 8 characters — too short Returns a random valid NIF Returns a deterministic valid NIF
(empty string) No content to parse Returns a random valid NIF Returns a deterministic valid NIF
Processors
RandomFormatFabricationProcessor

Generates a new fabricated NIF on every invocation. The output is non-deterministic.

Use when
Masking a NIF column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
12345678Z X6703180Z Different random NIF
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated NIF. The same input and IV always produce the same output across all runs.

Use when
Masking a NIF column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
12345678Z 60840504F 60840504F (same)
X1234567L 75138167L 75138167L (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "nif",
  "column_name_target": "nif_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SpanishNIF",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "nif",
  "column_name_target": "nif_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SpanishNIF",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
The check character is strictly validated
A NIF with the correct structure but a wrong check letter is treated as invalid. Ensure source data contains only correctly computed NIFs before applying Repeatable if consistent mapping is required.
The first character must be uppercase
The first character must be a digit or one of X, Y, Z in uppercase. A lowercase first character makes the input invalid.
Letters I, O, and U are not valid check characters
Only the 23 letters TRWAGMYFPDXBNJZSQVHLCKE are accepted for the check position.

EnglishNIN

Masks a UK National Insurance Number (NIN) by replacing it with a fabricated NIN that satisfies all structural constraints including the prefix letter rules and the suffix letter. The maximum output length is 13 characters. Apply to VARCHAR(13), CHAR(13), or TEXT columns only.

The prefix is two uppercase letters. Seven two-letter combinations are forbidden: BG, GB, NK, KN, TN, NT, ZZ. The suffix must be one of A, B, C, D, F, M, P. The fabrication engine always produces an output that includes a suffix, even when the input had none.

Valid input values
Example input Note
JC 27 36 20 C Spaced digits, suffix C
RR 232065 F Compact digits with surrounding spaces, suffix F
GX667694B Fully compact — no spaces, suffix B
JC 27 36 20 Spaced digits, no suffix — valid input
Invalid input values

Both fabrication processors silently fabricate a new valid NIN — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
BG 79 16 62 D BG is a forbidden prefix pair Returns a random valid NIN Returns a deterministic valid NIN
DA 12 34 56 A D not allowed in first prefix position Returns a random valid NIN Returns a deterministic valid NIN
JC 27 36 20 Z Z is not in the valid suffix set Returns a random valid NIN Returns a deterministic valid NIN
jc 27 36 20 C Lowercase prefix — not accepted Returns a random valid NIN Returns a deterministic valid NIN
(empty string) No content to parse Returns a random valid NIN Returns a deterministic valid NIN
Processors
RandomFormatFabricationProcessor

Generates a new fabricated NIN on every invocation. The output is non-deterministic.

Use when
Masking a NIN column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
JC 27 36 20 C OS 90 31 83 A Different random NIN
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated NIN. The same input and IV always produce the same output across all runs.

Use when
Masking a NIN column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
JC 27 36 20 C WX 05 47 79 D WX 05 47 79 D (same)
GX667694B JP971069C JP971069C (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "nin",
  "column_name_target": "nin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "EnglishNIN",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "nin",
  "column_name_target": "nin_masked",
  "masking_properties": {
    "magen_function": {
      "name": "EnglishNIN",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
Seven prefix pairs are forbidden
The pairs BG, GB, NK, KN, TN, NT, and ZZ are not allocated by HMRC. Inputs using these prefixes are treated as invalid.
Six letters are excluded from the first prefix position; seven from the second
The letters D, F, I, Q, U, V are invalid in the first position. The letter O is additionally invalid in the second position.
Output spacing style is not guaranteed to match the input
The fabrication engine can produce output in any valid combination of compact or spaced digits. The output always includes a suffix — even when the input had none.

SwedenID

Masks a Swedish Personal Identity Number (personnummer) by replacing it with a fabricated number that satisfies all structural constraints including the birth date, gender digit, and Luhn check digit. The maximum output length is 11 characters. Apply to VARCHAR(11), CHAR(11), or TEXT columns only.

The format encodes identity information in a fixed structure. The following table describes each field.

Table 7. SwedenID field structure
Position Field Format Description
1–6 Birth date yyMMdd Date of birth: year, month, day
7 Separator [ -]? Optional space or hyphen; absent in compact form
8–9 Serial \d{2} Birth county / sequence number
10 Gender digit [13579] or [02468] Odd = male, even = female
11 Check digit \d Luhn check digit computed over the preceding 10 digits
Valid input values
Example input Note
8311022386 Compact, Luhn-valid
831102-2386 Hyphen separator
831102 2386 Space separator
Invalid input values

Both fabrication processors silently fabricate a new valid Swedish ID — no exception is raised.

Value Reason RandomFormatFabricationProcessor RepeatableFormatFabricationProcessor
8311022380 Wrong Luhn check digit Returns a random valid Swedish ID Returns a deterministic valid Swedish ID
9913022386 Month 13 — invalid date Returns a random valid Swedish ID Returns a deterministic valid Swedish ID
831102.2386 Dot separator — not accepted Returns a random valid Swedish ID Returns a deterministic valid Swedish ID
(empty string) No content to parse Returns a random valid Swedish ID Returns a deterministic valid Swedish ID
Processors
RandomFormatFabricationProcessor

Generates a new fabricated Swedish ID on every invocation. The output is non-deterministic.

Use when
Masking a Swedish ID column where referential consistency across rows or job runs is not required.
Input Output (run 1) Output (run 2)
8311022386 190519-4005 Different random ID
RepeatableFormatFabricationProcessor

Produces a deterministic fabricated Swedish ID. The same input and IV always produce the same output across all runs.

Use when
Masking a Swedish ID column referenced as a key or used for joining across related tables, where the same source value must consistently map to the same masked value across all runs.
Input Output (run 1) Output (run 2)
8311022386 4211303211 4211303211 (same)
831102-2386 6312080176 6312080176 (same)
Configuration examples
RandomFormatFabricationProcessor
{
  "column_name_source": "sweden_id",
  "column_name_target": "sweden_id_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SwedenID",
      "type": "RandomFormatFabricationProcessor",
      "config": {}
    }
  }
}
RepeatableFormatFabricationProcessor
{
  "column_name_source": "sweden_id",
  "column_name_target": "sweden_id_masked",
  "masking_properties": {
    "magen_function": {
      "name": "SwedenID",
      "type": "RepeatableFormatFabricationProcessor",
      "config": {}
    }
  }
}
Known limitations
NULL values pass through unchanged
A NULL input produces a NULL output.
The Luhn check digit is strictly validated
An ID with a structurally valid format but an incorrect check digit is treated as invalid. Ensure source data contains only Luhn-valid IDs before applying Repeatable if consistent mapping is required.
The birth date is strictly validated
The first 6 digits must form a valid yyMMdd date. Month 00 or 13, and day 00 or 32, make the input invalid.
The dot separator is not supported
Only a hyphen (-) or space ( ) are accepted as separators. An input using a dot (for example, 831102.2386) is invalid.
Output separator style is not guaranteed to match the input
The fabrication engine can produce compact, hyphen, or space-separated output regardless of the input style. Under RepeatableFormatFabricationProcessor the output style is deterministic for the given input and IV but may differ from the source.