namespace OpenCand.Core.Utils { public static class CpfMasking { /// /// Masks a CPF number by replacing the middle 3 digits with '*' /// /// The CPF number to mask. /// The masked CPF number. public static string MaskCpf(string cpf) { if (string.IsNullOrEmpty(cpf) || cpf.Length != 11) { return cpf; } // Mask the middle 3 digits return $"{cpf.Substring(0, 3)}***{cpf.Substring(6)}"; } } }