{"id":15459696,"url":"https://github.com/dennis-tra/shamir","last_synced_at":"2026-03-09T18:38:38.079Z","repository":{"id":50746416,"uuid":"492972655","full_name":"dennis-tra/shamir","owner":"dennis-tra","description":"🔑 A CLI frontend for Hashicorp Vault's Shamir's Secret Sharing implementation.","archived":false,"fork":false,"pushed_at":"2023-07-10T16:19:27.000Z","size":17,"stargazers_count":26,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-05-05T21:16:16.349Z","etag":null,"topics":["apache2","cli","golang","hacktoberfest","hashicorp","hashicorp-vault","shamir-secret-sharing","vault"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dennis-tra.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":"2022-05-16T19:28:41.000Z","updated_at":"2025-03-23T09:02:58.000Z","dependencies_parsed_at":"2024-06-20T05:43:36.385Z","dependency_job_id":"af3c2336-9fdd-45ce-b066-4ad0237579ee","html_url":"https://github.com/dennis-tra/shamir","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/dennis-tra/shamir","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennis-tra%2Fshamir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennis-tra%2Fshamir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennis-tra%2Fshamir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennis-tra%2Fshamir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dennis-tra","download_url":"https://codeload.github.com/dennis-tra/shamir/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dennis-tra%2Fshamir/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30307548,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T17:35:44.120Z","status":"ssl_error","status_checked_at":"2026-03-09T17:35:43.707Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["apache2","cli","golang","hacktoberfest","hashicorp","hashicorp-vault","shamir-secret-sharing","vault"],"created_at":"2024-10-01T23:10:10.783Z","updated_at":"2026-03-09T18:38:38.042Z","avatar_url":"https://github.com/dennis-tra.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shamir\n\n[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)\n\nA CLI frontend for [Hashicorp Vault's](https://www.vaultproject.io/) [Shamir's Secret Sharing](https://en.wikipedia.org/wiki/Shamir%27s_Secret_Sharing) [implementation](https://github.com/hashicorp/vault/tree/main/shamir). This allows you to split a secret into `x` shares, and then combine them back into a single secret using any `y` of those shares with `y \u003c= x`.\n\n```shell\n$ shamir split secret.txt # default: split into 5 shares where you need any 3 to restore the secret (numbers configurable)\n```\n\n```shell\n$ shamir restore shares.txt # shares.txt should contain at least 3 newline separated shares from above\n```\n\n## Table of Contents\n\n- [Table of Contents](#table-of-contents)\n- [Background](#background)\n- [Install](#install)\n- [Usage](#usage)\n  - [Split](#split)\n  - [Restore](#restore)\n- [Related Efforts](#related-efforts)\n- [Maintainers](#maintainers)\n- [Contributing](#contributing)\n- [License](#license)\n\n## Background\n\nExtra care needs to be taken when dealing with secrets. Therefore, this tiny tool is designed to be:\n\n- **credible** - It uses [Hashicorp Vault's](https://github.com/hashicorp/vault/tree/main/shamir) Shamir's Secret Sharing implementation.\n- **minimal** - It only uses Go's standard library besides the above dependency.\n- **approachable** - The 131 [LoC](https://de.wikipedia.org/wiki/Lines_of_Code) should be quick and easy to audit yourself.\n\nFurther it's:\n\n- **configurable** - You can configure the number of shares and the number of shares needed to restore the secret.\n- **composable** - You can pipe [stdin](https://en.wikipedia.org/wiki/Standard_streams) to it and use it in scripts.\n\n\u003e *Write programs that do one thing and do it well.* - [Douglas McIlroy](https://en.wikipedia.org/wiki/Douglas_McIlroy)\n\n## Install\n\nWhen you are dealing with secrets I would recommend compiling the code yourself instead of relying on a binary distribution:\n\n```shell\ngo install github.com/dennis-tra/shamir@latest\n```\n\nMake sure the `$GOPATH/bin` is in your `PATH` variable to access the installed `shamir` executable.\n\n## Usage\n\n### Split\n\nLet's imagine you have confidential data in a file called `secret.txt`. You could then run any of the following commands:\n\n```shell\n$ shamir split secret.txt\n$ shamir split -shares 10 -threshold 5 secret.txt\n$ cat secret.txt | shamir split\n```\n\nThe CLI exposes the following options:\n\n- `-shares` - The number of shares to split the secret into.\n- `-threshold` - The number of shares needed to restore the secret.\n\nExample:\n\n```shell\n$ echo \"My very secret secret.\" | shamir split -shares 4 -threshold 3\ngU3GKbSg3CpSHtC+04y8OH9mtIdiq2tm\nGXmZfZhoqRAgzGO+fULXEXfDusDJuCcX\nByQs4+phvdU2zXzMjYvjA+7qLLTke8Uk\n9dV1XA0pJV2RDzLYh6qwKzjxJ+iBrd9W\n```\n\nEach line corresponds to one share of which you need any three to restore the original message.\n\nTo create separate files for each share, pipe `shamir` to the unix `split` command:\n\n```shell\n$ echo \"My very secret secret.\" | shamir split -shares 4 -threshold 3 | split -l 1 - share_\n```\n\n`-l 1` means to split after each line, `-` means to use stdin and `share_` is the prefix for the files. The above command will create 4 files named `share_aa`, `share_ab`, `share_ac` and `share_ad`. \n\n### Restore\n\nLet's imagine you have a file called `shares.txt` which contains more than `threshold` shares of your secret **separated by newlines**. You could then run any of the following commands:\n\n```shell\n$ shamir restore shares.txt\n$ cat shares.txt | shamir restore\n```\n\nExample:\n\n```shell\n$ echo \"9dV1XA0pJV2RDzLYh6qwKzjxJ+iBrd9W\\nByQs4+phvdU2zXzMjYvjA+7qLLTke8Uk\" | shamir restore # not enough shares\nVL_��n�!�m5��Π8\n$ echo \"9dV1XA0pJV2RDzLYh6qwKzjxJ+iBrd9W\\nByQs4+phvdU2zXzMjYvjA+7qLLTke8Uk\\ngU3GKbSg3CpSHtC+04y8OH9mtIdiq2tm\" | shamir restore\nMy very secret secret.\n```\n\nNote the `\\n` characters in the `echo` command to separate the shares from above. Share ordering is not relevant.\n\n## Related Efforts\n\n- [kinvolk/go-shamir](https://github.com/kinvolk/go-shamir) - A small CLI tool for Shamir's Secret Sharing written in Go, using Vault's Shamir implementation\n\n## Maintainers\n\n[@dennis-tra](https://github.com/dennis-tra).\n\n## Contributing\n\nFeel free to dive in! [Open an issue](https://github.com/RichardLitt/standard-readme/issues/new) or submit PRs.\n\n## License\n\n[Apache 2.0](LICENSE) © Dennis Trautwein","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennis-tra%2Fshamir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdennis-tra%2Fshamir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdennis-tra%2Fshamir/lists"}