Brazil CPF
Based >Extensible Algorithm Framework
The Brazil CPF algorithm is a built-in instance of the Checkdigit framework.
This algorithm masks input in the standard format of Brazilian CPF (Cadastro de Pessoas Fisicas) numbers.
The characteristics of the input numbers are:
-
11 digits:
-
9-digit body +
-
2 sequential Mod-11 check digits in the final two positions
-
-
formatting separators (., -, /) are accepted and preserved in the output
-
short inputs with no formatting characters are left-padded with zeros
The algorithm masks the 9-digit body using CM Digits, then recomputes two sequential Mod-11 check digits and places them in the final two positions.
Input that does not meet the expected format will be masked using a fallback instance of the CM Alpha-Numeric algorithm.
Examples
-
"485.620.000-35" -> "391.847.265-55"
-
"48562000035" -> “39184726555”