Skip to content

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SensitiveDataMasker

A tiny Java utility for masking sensitive text while keeping the last 4 characters visible.


Purpose

SensitiveDataMasker helps prevent sensitive values from being fully exposed in logs or console output by masking all characters except the last four.

4532123412345678 → ************5678

Tech Stack

  • Java 21
  • Maven
  • JUnit 5

How to Use

String masked = SensitiveDataMasker.mask("4532123412345678");

System.out.println(masked);

Output:

************5678

SensitiveDataMasker

Testing

The project uses JUnit 5 to verify the masking behavior, including boundary cases such as:

  • Strings with fewer than 4 characters
  • Strings with exactly 4 characters
  • Strings longer than 4 characters
  • Typical sensitive values

Run the tests with:

mvn test

Use Cases

  • Credit card masking
  • API key masking
  • Sensitive log data
  • Developer tools

Why I Built This

A small JavaLabs.io utility for experimenting with reusable Java components, automated testing, and practical data-protection patterns.

JavaLabs.io

Part of JavaLabs.io, a collection of Java-first experiments focused on building reusable components and backend systems.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages