String::Mask - mask sensitive data
Version 1.00
Quick summary of what the module does.
use String::Mask qw/mask/; mask('thisusedtobeanemail@gmail.com'); # thisusedtobean*****@*****.*** mask('thisusedtobeanemail@gmail.com', 'start', 5); # 'thisu**************@*****.***' mask('thisusedtobeanemail@gmail.com', 'end'); # '***************mail@gmail.com' mask('thisusedtobeanemail@gmail.com', 'end', 5); # '*******************@****l.com' mask('thisusedtobeanemail@gmail.com', 'middle'); # '*******dtobeanemail@g****.***' mask('thisusedtobeanemail@gmail.com', 'middle', 5); # '************anema**@*****.***' mask('thisusedtobeanemail@gmail.com', 'email'); # 'thisu**************@*****.***' mask('thisusedtobeanemail@gmail.com', 'email', 2); # 'thisusedtobeanema**@*****.***' mask('9991234567'); # '99912*****' mask('9991234567', 'start', 3); # '999*******' mask('9991234567', 'end'); # '*****34567' mask('9991234567', 'end', 3); # '*******567' mask('9991234567', 'middle'); # '**91234***' mask('9991234567', 'middle', 4); # '***1234***' mask('9991234567', 'middle', 4, '_'); # '___1234___'
Data masking or data obfuscation is the process of hiding original data with modified content (characters or other data). The main reason for applying masking to a string is to protect data that is classified as personally identifiable information, sensitive personal data, or commercially sensitive data. However, the data must remain usable for the purposes of undertaking valid test cycles. It must also look real and appear consistent.
This function accepts 4 arguments:
mask($string, $position, $length, $char);
The text that you like to mask.
The position you would like to be visible. Currently you have four options start, middle, end or email. The default is start.
The number of characters that should remain visible. The default is half the length of the passed string.
The mask character that will replace any masked text. The default is *.
LNATION, <email at lnation.org>
<email at lnation.org>
Please report any bugs or feature requests to bug-string-mask at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=String-Mask. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-string-mask at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc String::Mask
You can also look for information at:
RT: CPAN's request tracker (report bugs here)
https://rt.cpan.org/NoAuth/Bugs.html?Dist=String-Mask
CPAN Ratings
https://cpanratings.perl.org/d/String-Mask
Search CPAN
https://metacpan.org/release/String-Mask
This software is Copyright (c) 2020->2021 by LNATION.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
To install String::Mask, copy and paste the appropriate command in to your terminal.
cpanm
cpanm String::Mask
CPAN shell
perl -MCPAN -e shell install String::Mask
For more information on module installation, please visit the detailed CPAN module installation guide.