https://github.com/dwtechnologies/anonymize
Anonymize / Normalize package for Go
https://github.com/dwtechnologies/anonymize
anonymization encryption
Last synced: 5 months ago
JSON representation
Anonymize / Normalize package for Go
- Host: GitHub
- URL: https://github.com/dwtechnologies/anonymize
- Owner: dwtechnologies
- Created: 2017-01-08T10:20:50.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-11T08:38:40.000Z (about 9 years ago)
- Last Synced: 2026-02-14T05:01:44.665Z (5 months ago)
- Topics: anonymization, encryption
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# anonymize
The anonymize package can anonymize and/or normalize various forms of inputs (currently text, phone numbers and e-mails).
The anonymization part will use a variable salt based on the OS ENV var $SALT and encrypt it with SHA512. The variable part is based on the first UTF8 char number of the string to be anonymized.
$SALT must be at least 128 characters long.
The normalization will make sure that the input text will always be the same independent of case or leading/trailing whitespaces and such. It will also make phone numbers have a predictable format leading with 00 and removing all non-numeric characters.
The normalize and anonmyize first normalize the data and then anonymizes it.
----------
The package has the following functions.
## Email
### EmailAnonymize
```text
EmailAnonymize anonymizes String s with sha512 and with a random salt from OS env-var $SALT.
It returns an encrypted string.
```
### EmailNormalize
```text
EmailNormalize normalizes String s to lowercase and removes all spaces and tabs.
It returns an normalized string.
```
### EmailNormAnonymize
```text
EmailNormAnonymize normalizes String s to lowercase and removes all spaces and tabs and
also hashes s with sha512 and with a random salt from OS env-var $SALT.
It returns an normalized then encrypted string.
```
## Text / String
### StringAnonymize
```text
StringAnonymize anonymizes String s with sha512 and with a random salt from OS env-var $SALT.
It returns an encrypted string.
```
### StringNormalize
```text
StringNormalize normalizes String s to lowercase and removes all leading and trailing spaces and tabs.
It returns an normalized string.
```
### StringNormAnonymize
```text
StringNormAnonymize normalizes String s to lowercase and removes all leading and trailing spaces and tabs and
hashes s with sha512 and with a random salt from OS env-var $SALT.
It returns an normalized then encrypted string.
```
## Phone Number
### PhoneAnonymize
```text
PhoneAnonymize anonymizes String s with sha512 and with a random salt from OS env-var $SALT.
It returns an encrypted string.
```
### PhoneNormalize
```text
PhoneNormalize normalizes String s by removing all spaces and tabs and replacing the first
"+" with "00" and removing all other characters other than 0-9.
It returns an normalized string.
```
### PhoneNormAnonymize
```text
PhoneNormAnonymize normalizes String s by removing all spaces and tabs and replacing the first
"+" with "00" and removing all other characters other than 0-9 and
hashes s with sha512 and with a random salt from OS env-var $SALT.
It returns an normalized then encrypted string.
```