/hr-anon

Human Readable Data Anonymizer

Primary LanguageJavaMIT LicenseMIT

HR Anon

Human Readable Data Anonymizer

TL;DR

This little tool enables to anonymize any String or Number while retaining its original formatting.

Example

Source String:

<p class="test"><a href="test.com">p class test a href Test DiFfErEnT CASES 123456789 someone@email.com</a></p>

Anonymization:

//pass the boolean flag that tells the Anonymizer we are dealing with HTML/XML
HumanReadableAnonymizer.anonymize(source, true);

Anonymized Result:

<p class="test"><a href="test.com">u vitae nisl a urna Nisl TiNcIdUnT IPSUM 368038353 posuere@purus.est</a></p>

Conclusion

We can easily "ipsumify" any given input String without losing any of its original formatting (and HTML/XML Tags)

Rationale

It is very often difficult to reproduce bugs that are happening on PROD Environments. It would always be best to be able to just take a dump of Production Data and load it locally to perform the debug. However, more often than not we can't do this because PROD contains Client-owned data that we (as developers) shouldn't have access to. One use case of this tool (and the reason it was created) is the ability to anonymize such dumps to get rid of Client-sensitive data without losing any of the original formatting and structure of the data.

Installation

Add Maven Repository:

<repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
</repository>

Add Maven Dependency:

<dependency>
    <groupId>com.github.eXsio</groupId>
    <artifactId>hr-anon</artifactId>
    <version>1.0.4</version>
</dependency>

API

class HumanReadableAnonymizer;
public static String anonymize(String source, boolean isHtmlOrXml);
public static <T extends Number> T anonymize(T source);
public static String anonymizeTelephone(String string);