https://github.com/sjmudd/anonymiser
Anonymise some values for showing to the "public"
https://github.com/sjmudd/anonymiser
Last synced: about 1 month ago
JSON representation
Anonymise some values for showing to the "public"
- Host: GitHub
- URL: https://github.com/sjmudd/anonymiser
- Owner: sjmudd
- License: gpl-2.0
- Created: 2015-09-08T08:35:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-25T19:47:50.000Z (over 3 years ago)
- Last Synced: 2025-03-24T22:51:18.689Z (about 2 months ago)
- Language: Go
- Size: 16.6 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# anonymiser
Anonymise some values for showing to the "public"# Description.
Anonymiser allows a group of strings to be anonymised: that is
converted into another set of string values.Strings can be split into groups so that similar types of
strings are anonymised together.An example of this might be a program which is exposing database
and table names from an internal company database server. Here
we would like to anonymise the names being used but share the
output of the screen with anonymous information.All database names would be converted into `db1`, `db2` ... `dbn`,
and all table names converted into `table1`, `table2` ... `tablen`.Other similar use cases can be imagined.
An example: [`ps-top`](https://godoc.org/github.com/sjmudd/ps-top])
In `ps-top` I wanted to anonymise the host, database and table names
which were shown as they might expose internal information to third parties.
This package made that easy.There is basically one routine `anonymise.Anonymise( "group", "some_name" )`.
The first parameter is the name of the group of strings to be
anonyised, The second parameter is the name to anonymise and basically
each new name gets an id starting at 1. This id is added to the end
of the group name and that's what is returned as the anonymised
name.e.g.
To anonymise some database names:
* anonymise.Anonymise( "db", "my_db" ) --> db1
* anonymise.Anonymise( "db", "otherdb" ) --> db2
* anonymise.Anonymise( "db", "otherdb" ) --> db2
* anonymise.Anonymise( "db", "my_db" ) --> db1To anonymise some table names:
* anonymise.Anonymise( "table", "important_name" ) --> table1
* anonymise.Anonymise( "table", "something_else" ) --> table2
* anonymise.Anonymise( "table", "important_name" ) --> table1You can use as many prefixes as you like.
I guess in real code you'd do something like this:
```
var secret []string { ... } // holds strings of secrent information (maybe with duplicates)... // fill secret with useful data
for i := range secret {
fmt.Println( "secret:", secret[i], "==>", anonymise.Anonymise( "anonymised", secret[i] ) )
}
```# Installation
Install by doing:
* `go get github.com/sjmudd/anonymiser`# Documentation
Documentation can be found using `godoc` or at [https://godoc.org/github.com/sjmudd/anonymiser]