mask-pii for Zig
Use mask-pii in Zig to mask email addresses and phone numbers when you write logs or process data.
Mask email addresses
Mask part of the email address before the @ and leave the domain visible.
Mask phone numbers
Mask the phone number and leave the last four digits visible.
Choose what to mask
Before you run it, choose whether to mask email addresses, phone numbers, or both. You can also pick the character to use.
Install it and try an example
Install from a tagged Git release and load the Zig API. Run the example to turn on email and phone masking and see the result.
Installation
zig fetch --save https://github.com/finitefield-org/mask-pii/archive/refs/tags/v0.2.0.tar.gz
Try an example
src/main.zig
const std = @import("std");
const MaskPII = @import("mask-pii");
pub fn main() !void {
var masker = MaskPII.Masker.init();
_ = masker.maskEmails().maskPhones().withMaskChar('#');
const allocator = std.heap.page_allocator;
const input = "Contact: alice@example.com or 090-1234-5678.";
const output = try masker.process(allocator, input);
defer allocator.free(output);
try std.io.getStdOut().writer().print("{s}\n", .{output});
// Output: "Contact: a####@example.com or ###-####-5678."
}
More details
See the README for package details and API examples for this language.
Previous
Language indexNext
GitHub