{"id":36444905,"url":"https://github.com/tlmanz/hush","last_synced_at":"2026-01-11T22:04:05.169Z","repository":{"id":253001697,"uuid":"841954042","full_name":"tlmanz/hush","owner":"tlmanz","description":"Hush: A Go package for secure data masking and processing. Support for nested structures, and flexible masking rules.","archived":false,"fork":false,"pushed_at":"2024-11-13T17:59:34.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-13T18:41:12.813Z","etag":null,"topics":["data-deidentification","deidentification","golang","golang-library","privacy"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tlmanz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-13T11:30:24.000Z","updated_at":"2024-11-13T17:59:21.000Z","dependencies_parsed_at":"2024-11-13T18:32:44.730Z","dependency_job_id":"7a60c824-4dee-48aa-99c3-bf8002b98a95","html_url":"https://github.com/tlmanz/hush","commit_stats":null,"previous_names":["tlmanz/hush"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/tlmanz/hush","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlmanz%2Fhush","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlmanz%2Fhush/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlmanz%2Fhush/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlmanz%2Fhush/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tlmanz","download_url":"https://codeload.github.com/tlmanz/hush/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tlmanz%2Fhush/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28324855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T18:42:50.174Z","status":"ssl_error","status_checked_at":"2026-01-11T18:39:13.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-deidentification","deidentification","golang","golang-library","privacy"],"created_at":"2026-01-11T22:04:05.113Z","updated_at":"2026-01-11T22:04:05.164Z","avatar_url":"https://github.com/tlmanz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/tlmanz/hush/actions/workflows/ci.yml/badge.svg)](https://github.com/tlmanz/hush/actions/workflows/ci.yml)\n[![CodeQL](https://github.com/tlmanz/hush/actions/workflows/codequality.yml/badge.svg)](https://github.com/tlmanz/hush/actions/workflows/codequality.yml)\n[![Coverage Status](https://coveralls.io/repos/github/tlmanz/hush/badge.svg)](https://coveralls.io/github/tlmanz/hush)\n![Open Issues](https://img.shields.io/github/issues/tlmanz/hush)\n[![Go Report Card](https://goreportcard.com/badge/github.com/tlmanz/hush)](https://goreportcard.com/report/github.com/tlmanz/hush)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/tlmanz/hush)\n\n# Hush ![hush_logo](https://i.ibb.co/YT7wSvZ/logo.png)\n\nHush is a Go package that provides a flexible and efficient way to process and mask sensitive data in structs and strings.\n\n## Features\n\n- Process structs and strings etc to mask, hide or remove sensitive information\n- Customizable field separators for nested structures\n- Support for custom masking functions\n- Concurrent processing of struct fields for improved performance\n- Option to include or exclude private fields\n- Context-aware processing with cancellation support\n- Consistent handling of maps and slices\n\n## Installation\n\nTo install Hush, use `go get`:\n\n```\ngo get github.com/tlmanz/hush\n```\n\n## Usage\n\nHere's a basic example of how to use Hush:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/tlmanz/hush\"\n)\n\ntype User struct {\n\tName     string\n\tPassword string   `hush:\"hide\"`\n\tAges     []int    `hush:\"mask\"`\n\tEmails   []string `hush:\"remove\"`\n}\n\nfunc main() {\n\tuser := User{\n\t\tName:     \"John\",\n\t\tPassword: \"secret123\",\n\t\tAges:     []int{301, 312, 323},\n\t\tEmails:   []string{\"john@example.com\", \"john2@example.com\"},\n\t}\n\n\thusher := hush.NewHush()\n\n\tresult, err := husher.Hush(context.Background(), 10, \"TESTFIELD\", hush.TagHide)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"String Usage Example (With Prefix):\")\n\tfor _, field := range result {\n\t\tfmt.Printf(\"%s: %s\\n\", field[0], field[1])\n\t}\n\n\tresult, err = husher.Hush(context.Background(), 10, hush.TagHide)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"\\nString Usage Example:\")\n\tfor _, field := range result {\n\t\tfmt.Printf(\"%s\\n\", field[0])\n\t}\n\n\tresult, err = husher.Hush(context.Background(), user)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"\\nStruct Usage Example:\")\n\tfor _, field := range result {\n\t\tfmt.Printf(\"%s: %s\\n\", field[0], field[1])\n\t}\n}\n```\n\nThis will output:\n```\nString Usage Example (With Prefix):\nTESTFIELD: HIDDEN\n\nString Usage Example:\nHIDDEN\n\nStruct Usage Example:\nAges[0]: ***\nAges[1]: ***\nAges[2]: ***\nName: John\nPassword: HIDDEN\n```\n\n## Configuration\n\nHush provides several options to customize its behavior:\n\n- `WithSeparator(sep string)`: Set a custom separator for nested field names (default is \".\")\n- `WithMaskFunc(f func(string) string)`: Set a custom masking function\n- `WithPrivateFields(include bool)`: Include or exclude private fields in the output\n\nThere are also options we can use specific to Non Composite types like strings, maps, slices, etc.\n\n- `prefix string`: Set a prefix for the field name\n- `maskType hush.HushType (hush.TagMask or hush.TagHide)`: Set the type of masking to be applied. By default it will return the value as is.\n\nExamples:\n\n```go\nresult, err := husher.Hush(context.Background(), data,\n    hush.WithSeparator(\"_\"),\n    hush.WithPrivateFields(true),\n    hush.WithMaskFunc(func(s string) string {\n        return \"CUSTOM_MASKED\"\n    }),\n)\n```\n\n```go\nresult, err := husher.Hush(context.Background(), \"johndoe@mail.com\", \"EMAIL\", hush.TagMask)\n```\n\n## Private Fields\n\nBy default, Hush doesn't process private (unexported) fields. You can include private fields in the output by using the `WithPrivateFields` option:\n\n```go\nresult, err := husher.Hush(context.Background(), \"\",\n    hush.WithPrivateFields(true),\n)\n```\n\nThis will include private fields in the output, applying the same masking rules as public fields.\n\n## Notes\n\n- Map keys are sorted alphabetically in the output for consistent results\n- Slices and arrays are processed with index-based field names\n\n## Examples\n\nCheck out the `examples` folder for more detailed usage examples:\n\n- `basic_usage.go`: Demonstrates basic usage with a simple struct\n- `custom_options.go`: Shows how to use custom options like separators and masking functions\n- `complex_struct.go`: Illustrates handling of complex structs with nested fields, slices, and maps\n- `custom_options_table.go`: Shows how to use custom options like separators and masking functions and display the result in a table\n- `custom_regex_function.go`: Shows how to use a custom regex function to mask the data\n- `private_fields.go`: Shows how to include private fields in the output\n\nTo run an example:\n\n```\ngo run examples/basic_usage.go\ngo run examples/custom_options.go\ngo run examples/complex_struct.go\ngo run examples/custom_options_table.go\ngo run examples/private_fields.go\ngo run examples/custom_regex_function.go\n```\n\n## License\n\nHush is released under the MIT License. See the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlmanz%2Fhush","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftlmanz%2Fhush","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftlmanz%2Fhush/lists"}