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.
| 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 AsianSingle word, title case Han ChineseMulti-word entry Other Pacific IslanderLongest entry — 22 characters Beti-PahuinHyphenated entry ZuluSingle 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 asianAll lowercase — dictionary stores AsianReturns a valid dictionary entry (input ignored) ASIANAll uppercase — case mismatch Returns a valid dictionary entry (input ignored) Native AmericanNot in the dictionary Returns a valid dictionary entry (input ignored) MixedNot 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) AsianLubaDifferent random entry Han ChineseNagaDifferent 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) AsianPolePole(same)Han ChineseMongolMongol(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, andASIANare 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:
0for numeric columns,falsefor boolean, andNULLfor 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 BlueSingle word, title case GrayUS spelling — both GrayandGreyare recognizedGreyUK spelling — independent dictionary entry from GrayRed-VioletHyphenated entry Red and VioletMulti-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 blueAll lowercase — dictionary stores BlueReturns a valid dictionary entry (input ignored) BLUEAll uppercase — case mismatch Returns a valid dictionary entry (input ignored) BlackNot in the dictionary Returns a valid dictionary entry (input ignored) Light BrownNot 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) BlueRed-VioletDifferent random entry HazelAmberDifferent 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) AmberRed and VioletRed and Violet(same)GrayAmberAmber(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, andRed and Violeteach map to a different masked value underRepeatableFormatFabricationProcessor. If source data uses these forms inconsistently, masked outputs will differ for what is semantically the same color.GrayandGreyare 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 MaleSingle word, title case TransgenderSingle word Gender non-conformingMulti-word — second word lowercase; longest entry at 21 characters Non-BinaryHyphenated — both words capitalized Fa'afafineContains 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 maleAll lowercase — dictionary stores MaleReturns a valid dictionary entry (input ignored) MALEAll uppercase — case mismatch Returns a valid dictionary entry (input ignored) Gender Non-ConformingWrong casing — dictionary stores lowercase nonReturns a valid dictionary entry (input ignored) MSingle-character abbreviation — not in the dictionary Returns a valid dictionary entry (input ignored) FSingle-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) MaleBaklaDifferent random entry Non-BinaryGenderfluidDifferent 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) MaleMaleMale(same)Non-BinaryGenderqueerGenderqueer(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-conformingstores a lowercasen—Gender Non-Conformingis not recognized.Non-Binarycapitalizes both words —non-binaryandNon-binaryare not recognized. Source data must match the exact stored casing.- Common abbreviations are not in the dictionary
MandFare not recognized. They are treated as non-dictionary inputs and receive fabricated values with no relationship toMaleorFemale.
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 BlackSingle word, title case GreyUK spelling — independent entry from GrayGrayUS spelling — independent entry from GreyWhite-GreyHyphenated — both words capitalized White and GrayMulti-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 blackAll lowercase — dictionary stores BlackReturns a valid dictionary entry (input ignored) White And GrayWrong internal casing — dictionary stores lowercase andReturns a valid dictionary entry (input ignored) Dark BrownNot in the dictionary Returns a valid dictionary entry (input ignored) SilverNot 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) BlackWhite/GreyDifferent random entry AuburnBlondeDifferent 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) BlackBlackBlack(same)AuburnBlondBlond(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
Whitecompound variants differ by separator (-,/,and) and spelling (Grey/Gray).White-grey(lowercase second word) does not matchWhite-Grey, andWhite And Gray(capitalizedAnd) does not matchWhite and Gray. Source data must use the exact stored form. BlondandBlondeare distinct entries- Each maps to a different masked value under
RepeatableFormatFabricationProcessor. Similarly,GrayandGreyare 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 enEnglish — 2-character code, lowercase frFrench deGerman zhChinese simpleLongest entry — 6 characters aaRank-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 FormatPreservingRedactionProcessorFormatPreservingTokenizationProcessorRandomFormatFabricationProcessorRepeatableFormatFabricationProcessorENUppercase — set stores enIllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid code Silently returns a deterministic valid code EnglishFull language name — not in the set IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid code Silently returns a deterministic valid code en-USBCP 47 locale tag with region — not in the set IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid code Silently returns a deterministic valid code (empty string) No content to parse IllegalArgumentExceptionMagenPayloadExceptionSilently 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 enaafraasimpleaa 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 enetfrmwldegansimplebn 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) enetet(same)frmwlmwl(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) enviDifferent random code frkaDifferent 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
FormatPreservingRedactionProcessorraisesIllegalArgumentException;FormatPreservingTokenizationProcessorraisesMagenPayloadException. 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, andENGLISHare each treated as distinct values. ISO codes are stored in lowercase.Example input Note EnglishFull name, title case enISO 639-1 code, lowercase engISO 639-3 code, lowercase DeutschNative-script name Egyptian ArabicMulti-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 englishAll lowercase — dictionary stores EnglishReturns a valid dictionary entry (input ignored) ENUppercase ISO code — dictionary stores enReturns a valid dictionary entry (input ignored) Simplified ChineseNot 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) EnglishNorth NdebeleDifferent random entry encesDifferent 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) EnglishLibyan ArabicLibyan Arabic(same)FrenchHuizhouHuizhou(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
ENandENGare treated as non-dictionary inputs and receive different masked values thanenandeng.- The same language appears under multiple distinct entries
- English is represented by
English,en, andeng. UnderRepeatableFormatFabricationProcessor, 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 EnglishSingle word, title case bat-SamogitianLowercase prefix + hyphen + title case suffix be-x-BelarusianDouble-hyphen prefix variant — longest entry at 15 characters SimpleStub 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 englishAll lowercase — set stores EnglishReturns a valid set entry (input ignored) bat-samogitianLowercase suffix — set stores bat-SamogitianReturns a valid set entry (input ignored) Mandarin ChineseNot 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) EnglishAlbanianDifferent random entry zh-ClassicalLowDifferent 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) EnglishGalicianGalician(same)FrenchEsperantoEsperanto(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, andbe-x-Belarusianstore lowercase prefixes and title-cased suffixes.Bat-Samogitian(capital B) andbat-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 MarriedSingle word, title case SingleSingle word Civil PartnerTwo words, both capitalized Surviving Civil PartnerThree 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 marriedAll lowercase — dictionary stores MarriedReturns a valid dictionary entry (input ignored) Civil partnerSecond word not capitalized Returns a valid dictionary entry (input ignored) UnmarriedNot 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) SingleCivil PartnerDifferent random entry WidowedSeparatedDifferent 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) SingleSingleSingle(same)WidowedSeparatedSeparated(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 PartnerandSurviving Civil Partnerstore each word in title case. Variants such asCivil partnerandcivil partnerare 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.
| 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 5551231234Plain 10 digits, no separator 555-123-4567Hyphen separator 555.123.4567Dot separator (416)555-1234Parenthesized area code, hyphen separator (416) 555-1234Parenthesized 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 FormatPreservingRedactionProcessorFormatPreservingTokenizationProcessorRandomFormatFabricationProcessorRepeatableFormatFabricationProcessor+1-555-123-4567International +1prefix not supportedIllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid phone number Silently returns a deterministic valid phone number 1-800-555-1234Leading country code digit IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid phone number Silently returns a deterministic valid phone number 55-1234-5678Area code has only 2 digits IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid phone number Silently returns a deterministic valid phone number (empty string) No content to parse IllegalArgumentExceptionMagenPayloadExceptionSilently 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-4567000-000-0000(416) 555-1234(000) 000-000055512312340000000000 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-4567941-173-1243555.123.4567941.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-4567560-141-5860560-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-4567435-891-1177Different 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-4567and1-800-555-1234are invalid. Strip any leading country code before applying the policy.- Redaction and tokenization raise exceptions for invalid inputs
FormatPreservingRedactionProcessorraisesIllegalArgumentException;FormatPreservingTokenizationProcessorraisesMagenPayloadException. 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 asexualhas only the first word capitalized.Example input Note BisexualSingle word, title case GaySingle word PansexualSingle word Libidoist asexualMulti-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 bisexualAll lowercase — dictionary stores BisexualReturns a valid dictionary entry (input ignored) Libidoist AsexualBoth words capitalized — dictionary stores lowercase asexualReturns a valid dictionary entry (input ignored) StraightNot 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) BisexualAutosexualDifferent random entry Libidoist asexualSpectrasexualDifferent 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) BisexualMultisexualMultisexual(same)Libidoist asexualBicuriousBicurious(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 asexualuses mixed capitalization- Unlike all other entries, which are fully title-cased,
Libidoist asexualhas 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.
| Group | Valid range | Forbidden values |
|---|---|---|
| Area (AAA) | 001–665 and 667–899 |
000, 666, 900–999 |
| Group (GG) | 01–99 |
00 |
| Serial (SSSS) | 0001–9999 |
0000 |
- Valid input values
-
Example input Note 123-45-6789Hyphen separator 123 45 6789Space separator 123456789No separator (plain 9 digits) 001-01-0001Minimum valid values - Invalid input values
-
Both fabrication processors silently fabricate a new valid SSN for invalid inputs — no exception is raised.
Value Reason RandomFormatFabricationProcessorRepeatableFormatFabricationProcessor000-45-6789Area 000is forbiddenReturns a random valid SSN Returns a deterministic valid SSN 666-45-6789Area 666is forbiddenReturns a random valid SSN Returns a deterministic valid SSN 123-00-6789Group 00is forbiddenReturns a random valid SSN Returns a deterministic valid SSN 123-45-0000Serial 0000is forbiddenReturns a random valid SSN Returns a deterministic valid SSN 123.45.6789Dot 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-6789059-92-6675Different random SSN 123456789341935762Different 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-6789009-33-3254009-33-3254(same)123456789009333254009333254(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, or900–999; group00; or serial0000are 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 1HGCM82633A004352Typical North American VIN JH4KA7660NC024816Japanese manufacturer VIN WAUZZZ4G4DN092842European manufacturer VIN 12345678901234567All digits, 17 characters ZZZZZZZZZZZZZZZZZAll 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 FormatPreservingRedactionProcessorFormatPreservingTokenizationProcessorRandomFormatFabricationProcessorRepeatableFormatFabricationProcessor1HGCM826I3A004352Contains I(excluded letter)IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid VIN Silently returns a deterministic valid VIN 1HGCM82633A00435Only 16 characters IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid VIN Silently returns a deterministic valid VIN 1hgcm82633a004352Lowercase letters IllegalArgumentExceptionMagenPayloadExceptionSilently returns a valid VIN Silently returns a deterministic valid VIN (empty string) No content to parse IllegalArgumentExceptionMagenPayloadExceptionSilently 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 1HGCM82633A00435200000000000000000ZZZZZZZZZZZZZZZZZ00000000000000000 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 1HGCM82633A004352T2UE492E13MA42GLRJH4KA7660NC024816M2X5F953RTBYMGKDGZZZZZZZZZZZZZZZZZATVNUMBF36XC3KUNB 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) 1HGCM82633A004352T2UE492E13MA42GLRT2UE492E13MA42GLR(same)WAUZZZ4G4DN09284258KASZJ510211LA5Z58KASZJ510211LA5Z(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) 1HGCM82633A004352SCF9Z3VEZLFCY1L4JDifferent 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, orQ— 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
FormatPreservingRedactionProcessorraisesIllegalArgumentException;FormatPreservingTokenizationProcessorraisesMagenPayloadException. 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.
| 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 046454286Plain 9 digits, Luhn-valid 046-454-286Uniform hyphen separators 046 454 286Uniform space separators 046-454 286Mixed separators — valid - Invalid input values
-
Both fabrication processors silently fabricate a new valid SIN for invalid inputs — no exception is raised.
Value Reason RandomFormatFabricationProcessorRepeatableFormatFabricationProcessor046454287Invalid Luhn check digit (correct digit is 6)Returns a random valid SIN Returns a deterministic valid SIN 04645428Only 8 digits Returns a random valid SIN Returns a deterministic valid SIN 046.454.286Dot 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) 046454286232406090Different random SIN 046-454-286714-876-844Different 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) 046454286639840545639840545(same)046-454-286639-840-545639-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,
046454287instead of046454286) 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
RepeatableFormatFabricationProcessorthe 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.
| Position | Field | Values | Description |
|---|---|---|---|
| 1 | Gender (s) |
1 or 2 |
1 = male (permanent), 2 = female (permanent) |
| 2–3 | Birth year (yy) |
00–99 |
Last two digits of birth year |
| 4–5 | Birth month (mm) |
01–12 |
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) |
01–97 |
97 − (body mod 97), zero-padded |
- Valid input values
-
Example input Note 1930612345678 12Male, born June 1993, control key 122850312345001 97Female, 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 RandomFormatFabricationProcessorRepeatableFormatFabricationProcessor0930612345678 12Gender 0— only1or2allowedReturns a random valid INSEE number Returns a deterministic valid INSEE number 1930012345678 12Month 00— forbiddenReturns a random valid INSEE number Returns a deterministic valid INSEE number 1930612345678 11Wrong control key (correct key is 12)Returns a random valid INSEE number Returns a deterministic valid INSEE number 1930612345678-12Hyphen 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 121391155479715 75Different 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 122380788814739 062380788814739 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,3for 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.
| 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 (00–99) |
| 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} |
01–31 for male; 41–71 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 MRTMTT25D09F205ZReference example — surname MRT, first name MTT, month D (April), town F205, check Z RSSMRA85M01H501UMale, born January 1985, Rome (H501) MRNGLA70A41F205OFemale, 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 RandomFormatFabricationProcessorRepeatableFormatFabricationProcessormRTMTT25D09F205ZLowercase letter in surname Returns a random valid fiscal code Returns a deterministic valid fiscal code MRTMTT25I09F205ZIis not in the valid month set{ABCDEHLMPRST}Returns a random valid fiscal code Returns a deterministic valid fiscal code MRTMTT25D09F205AIncorrect check letter (correct is Z)Returns a random valid fiscal code Returns a deterministic valid fiscal code MRTMTT25D09F205Only 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) MRTMTT25D09F205ZVVYTAH18B04B048UDifferent 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) MRTMTT25D09F205ZNENBGX93A07B083MNENBGX93A07B083M(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
RepeatableFormatFabricationProcessora lowercase variant maps to a different output than its uppercase equivalent. - Day range 32–40 is forbidden for both genders
- Male days run
01–31; female days run41–71. The values32–40are 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 Tare 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 0–9 (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 12345678ZStandard DNI — correct check X1234567LNIE starting with X— correct checkY1234567XNIE starting with Y— correct checkZ9999999WNIE starting with Z— correct check - Invalid input values
-
Both fabrication processors silently fabricate a new valid NIF — no exception is raised.
Value Reason RandomFormatFabricationProcessorRepeatableFormatFabricationProcessor12345678AAis not the correct check for body12345678Returns a random valid NIF Returns a deterministic valid NIF A1234567ZAis not in the valid first-character set[0-9XYZ]Returns a random valid NIF Returns a deterministic valid NIF 12345678IIis not a valid check characterReturns a random valid NIF Returns a deterministic valid NIF 1234567Z8 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) 12345678ZX6703180ZDifferent 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) 12345678Z60840504F60840504F(same)X1234567L75138167L75138167L(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,Zin uppercase. A lowercase first character makes the input invalid. - Letters I, O, and U are not valid check characters
- Only the 23 letters
TRWAGMYFPDXBNJZSQVHLCKEare 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 CSpaced digits, suffix CRR 232065 FCompact digits with surrounding spaces, suffix FGX667694BFully compact — no spaces, suffix BJC 27 36 20Spaced digits, no suffix — valid input - Invalid input values
-
Both fabrication processors silently fabricate a new valid NIN — no exception is raised.
Value Reason RandomFormatFabricationProcessorRepeatableFormatFabricationProcessorBG 79 16 62 DBGis a forbidden prefix pairReturns a random valid NIN Returns a deterministic valid NIN DA 12 34 56 ADnot allowed in first prefix positionReturns a random valid NIN Returns a deterministic valid NIN JC 27 36 20 ZZis not in the valid suffix setReturns a random valid NIN Returns a deterministic valid NIN jc 27 36 20 CLowercase 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 COS 90 31 83 ADifferent 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 CWX 05 47 79 DWX 05 47 79 D(same)GX667694BJP971069CJP971069C(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, andZZare 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,Vare invalid in the first position. The letterOis 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.
| 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 8311022386Compact, Luhn-valid 831102-2386Hyphen separator 831102 2386Space separator - Invalid input values
-
Both fabrication processors silently fabricate a new valid Swedish ID — no exception is raised.
Value Reason RandomFormatFabricationProcessorRepeatableFormatFabricationProcessor8311022380Wrong Luhn check digit Returns a random valid Swedish ID Returns a deterministic valid Swedish ID 9913022386Month 13— invalid dateReturns a random valid Swedish ID Returns a deterministic valid Swedish ID 831102.2386Dot 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) 8311022386190519-4005Different 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) 831102238642113032114211303211(same)831102-238663120801766312080176(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
yyMMdddate. Month00or13, and day00or32, 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
RepeatableFormatFabricationProcessorthe output style is deterministic for the given input and IV but may differ from the source.