Guides
Masking
Replace detected PII with asterisks while preserving the original value length.
PrivacyGuard.mask() replaces each detected value with asterisks.
Basic masking
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["cz"])
text = "Kontakt: jan.novak@email.cz, RČ 8001011238, IČO 25596641"
masked = guard.mask(text)
print(masked)Output:
Kontakt: ******************, RČ **********, IČO ********Preserves original length
The mask length matches len(finding.value) for each detected item.
from fastpii import PrivacyGuard
guard = PrivacyGuard(regions=["cz"])
print(guard.mask("Email: jan.novak@email.cz"))
print(guard.mask("IČO: 25596641"))Possible output:
Email: ******************
IČO: ********Use masking when you want to hide the value but keep rough layout and length cues.