{"id":29184078,"url":"https://github.com/super-e/slip39dotnet","last_synced_at":"2026-04-13T20:31:51.109Z","repository":{"id":302037602,"uuid":"1011030212","full_name":"super-e/Slip39DotNet","owner":"super-e","description":"Complete .NET implementation of SLIP-0039 Shamir's Secret Sharing with BIP32 support","archived":false,"fork":false,"pushed_at":"2025-06-30T08:28:37.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-30T08:43:33.747Z","etag":null,"topics":["bip32","bitcoin","cryptocurrency","cryptography","csharp","dotnet","mnemonic","secret-sharing","shamir-secret-sharing","slip-0039","vibe-coding"],"latest_commit_sha":null,"homepage":"","language":"C#","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/super-e.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-30T07:43:59.000Z","updated_at":"2025-06-30T08:28:41.000Z","dependencies_parsed_at":"2025-06-30T08:53:39.159Z","dependency_job_id":null,"html_url":"https://github.com/super-e/Slip39DotNet","commit_stats":null,"previous_names":["super-e/slip39dotnet"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/super-e/Slip39DotNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/super-e%2FSlip39DotNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/super-e%2FSlip39DotNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/super-e%2FSlip39DotNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/super-e%2FSlip39DotNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/super-e","download_url":"https://codeload.github.com/super-e/Slip39DotNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/super-e%2FSlip39DotNet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263035778,"owners_count":23403424,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["bip32","bitcoin","cryptocurrency","cryptography","csharp","dotnet","mnemonic","secret-sharing","shamir-secret-sharing","slip-0039","vibe-coding"],"created_at":"2025-07-01T21:02:00.657Z","updated_at":"2026-04-13T20:31:51.065Z","avatar_url":"https://github.com/super-e.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SLIP-0039 .NET Implementation\n\n[![.NET](https://img.shields.io/badge/.NET-9.0-blue.svg)](https://dotnet.microsoft.com/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Build Status](https://img.shields.io/badge/build-passing-brightgreen.svg)]()\n\nA complete .NET implementation of [SLIP-0039](https://github.com/satoshilabs/slips/blob/master/slip-0039.md) Shamir's Secret Sharing for mnemonic codes, providing both a core library and a command-line interface.\n\n## Features\n\n- ✅ **Complete SLIP-0039 Implementation** - Full compliance with the specification\n- ✅ **Shamir's Secret Sharing** - Split secrets into multiple shares with configurable thresholds\n- ✅ **Multi-Group Support** - Advanced group-based sharing with flexible recovery strategies\n- ✅ **BIP32 Extended Key Support** - Split and recover BIP32 extended private keys (xprv)\n- ✅ **BIP32 Master Key Generation** - Generate HD wallet master keys from recovered secrets\n- ✅ **Passphrase Support** - Optional passphrase protection for enhanced security\n- ✅ **Command Line Interface** - Comprehensive CLI for all operations\n- ✅ **Cross-Platform** - Runs on Windows, Linux, and macOS\n- ✅ **Comprehensive Testing** - Extensive test suite with official test vectors\n- ✅ **Memory Safety** - Secure handling of sensitive cryptographic material\n\n## Quick Start\n\n### Installation\n\n#### Using .NET CLI\n```bash\ngit clone https://github.com/yourusername/Slip39DotNet.git\ncd Slip39DotNet\ndotnet build\n```\n\n#### Using the CLI Tool\n```bash\n# Split a 256-bit secret into shares\ndotnet run --project Slip39.Console split --secret \"a1b2c3d4e5f67890abcdef1234567890fedcba0987654321a1b2c3d4e5f67890\" --threshold 2 --shares 3\n\n# Combine shares to recover the secret\ndotnet run --project Slip39.Console combine \"mnemonic1\" \"mnemonic2\"\n\n# Split a BIP32 extended private key into shares\ndotnet run --project Slip39.Console split-xpriv --xpriv \"xprv9s21ZrQH143K...\" --threshold 2 --shares 3\n\n# Generate random secret and split into shares\ndotnet run --project Slip39.Console generate --bits 256 --threshold 2 --shares 3\n```\n\n### Library Usage\n\n```csharp\nusing Slip39.Core;\n\n// Split a 128-bit secret into shares\nvar secret = Convert.FromHexString(\"a1b2c3d4e5f67890abcdef1234567890\");\nvar groupConfigs = new List\u003cSlip39ShareGeneration.GroupConfig\u003e { new(2, 3) };\nvar shares = Slip39ShareGeneration.GenerateShares(\n    groupThreshold: 1,\n    groupConfigs: groupConfigs,\n    masterSecret: secret,\n    passphrase: \"optional_passphrase\"\n);\n\n// Convert shares to mnemonics\nvar mnemonics = shares.Select(share =\u003e share.ToMnemonic()).ToArray();\n\n// Later, combine shares to recover the secret\nvar recoveredSecret = Slip39ShareCombination.CombineShares(shares.Take(2).ToList(), \"optional_passphrase\");\nConsole.WriteLine($\"Recovered: {Convert.ToHexString(recoveredSecret)}\");\n\n// Generate BIP32 master key from recovered secret\nvar masterKey = Bip32MasterKey.GenerateMasterKey(recoveredSecret, \"optional_passphrase\");\nConsole.WriteLine($\"Master Key: {masterKey}\");\n```\n\n### Multi-Group Shares\n\nSLIP-0039 supports multi-group shares, allowing you to create different groups with separate recovery thresholds. This provides more flexible recovery strategies.\n\n```csharp\nusing Slip39.Core;\n\n// Define a 256-bit secret\nvar secret = Convert.FromHexString(\"a1b2c3d4e5f67890abcdef1234567890fedcba0987654321a1b2c3d4e5f67890\");\n\n// Define groups with their thresholds and share counts\nvar groupConfigs = new List\u003cSlip39ShareGeneration.GroupConfig\u003e\n{\n    new(2, 3), // Group 1: 2-of-3 shares needed\n    new(1, 2)  // Group 2: 1-of-2 shares needed  \n};\n\n// Generate multi-group shares (need 1 group to recover)\nvar shares = Slip39ShareGeneration.GenerateShares(\n    groupThreshold: 1,\n    groupConfigs: groupConfigs,\n    masterSecret: secret,\n    passphrase: \"optional_passphrase\"\n);\n\n// Convert shares to mnemonics\nvar mnemonics = shares.Select(share =\u003e share.ToMnemonic()).ToArray();\n\n// To recover the secret, you need to meet the threshold for at least one group\n// For example, provide 2 shares from Group 1 OR 1 share from Group 2\nvar group1Shares = shares.Where(s =\u003e s.GroupIndex == 0).Take(2).ToList();\nvar recoveredSecret = Slip39ShareCombination.CombineShares(group1Shares, \"optional_passphrase\");\nConsole.WriteLine($\"Recovered: {Convert.ToHexString(recoveredSecret)}\");\n```\n\n### BIP32 Extended Private Key Support\n\nSLIP39DotNet provides native support for backing up BIP32 extended private keys (xprv) using SLIP-0039 shares. This allows you to securely backup and recover HD wallet master keys.\n\n```csharp\nusing Slip39.Core;\n\n// Your BIP32 extended private key (from hardware wallet, etc.)\nvar originalXpriv = \"xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi\";\n\n// Decode and extract the private key and chain code (64 bytes total)\nvar extendedKeyData = Base58Check.Decode(originalXpriv);\nvar privateKey = new byte[32];\nvar chainCode = new byte[32];\nArray.Copy(extendedKeyData, 46, privateKey, 0, 32); // Private key at offset 46\nArray.Copy(extendedKeyData, 13, chainCode, 0, 32);  // Chain code at offset 13\n\n// Combine into 64-byte master secret\nvar masterSecret = new byte[64];\nArray.Copy(privateKey, 0, masterSecret, 0, 32);\nArray.Copy(chainCode, 0, masterSecret, 32, 32);\n\n// Generate SLIP-0039 shares from the BIP32 key\nvar groupConfigs = new List\u003cSlip39ShareGeneration.GroupConfig\u003e { new(2, 3) };\nvar shares = Slip39ShareGeneration.GenerateShares(\n    groupThreshold: 1,\n    groupConfigs: groupConfigs,\n    masterSecret: masterSecret,\n    passphrase: \"TREZOR\", // Standard passphrase\n    iterationExponent: 0,\n    isExtendable: false);\n\n// Later, recover the original xprv from shares\nvar recoveredSecret = Slip39ShareCombination.CombineShares(shares.Take(2).ToList(), \"TREZOR\");\n\n// Reconstruct the BIP32 extended private key\n// ... (BIP32 reconstruction logic)\nvar reconstructedXpriv = ReconstructBip32ExtendedKey(recoveredSecret);\nConsole.WriteLine($\"Recovered xprv: {reconstructedXpriv}\");\n```\n\n**Key Features:**\n- **Full xprv Recovery**: Exactly reconstructs the original BIP32 extended private key\n- **64-byte Secrets**: Handles the full private key (32 bytes) + chain code (32 bytes)\n- **Long Mnemonics**: Generates 59-word mnemonics for 64-byte secrets\n- **CLI Integration**: Use `split-xpriv` and `combine --bip32` commands\n\n## Projects\n\n### Slip39.Core\nThe core library implementing SLIP-0039 specification:\n- **Slip39ShareGeneration** - Create mnemonic shares from secrets\n- **Slip39ShareCombination** - Recover secrets from shares  \n- **Slip39ShareParser** - Parse and validate mnemonic strings\n- **Slip39Encryption** - SLIP-0039 encryption/decryption with PBKDF2 and Feistel network\n- **Bip32MasterKey** - Generate BIP32 extended private keys\n- **Base58Check** - Base58Check encoding/decoding for BIP32 keys\n- **Cryptographic primitives** - GF(256) operations, polynomial interpolation, RS1024 checksums\n- **Multi-group support** - Advanced group-based sharing configurations\n\n### Slip39.Console  \nCommand-line interface providing:\n- **split** - Split secrets into mnemonic shares\n- **split-xpriv** - Split BIP32 extended private keys into shares\n- **combine** - Combine shares to recover secrets\n- **combine --bip32** - Recover and reconstruct BIP32 extended private keys\n- **info** - Display detailed share information\n- **validate** - Validate share checksums\n- **generate** - Generate random secrets and split into shares\n- **Multi-format output** - Text, JSON, and hex output formats\n\n## CLI Commands\n\n### Basic Secret Sharing\n\n```bash\n# Split a 128-bit secret into shares (single group)\ndotnet run --project Slip39.Console split --secret \"a1b2c3d4e5f67890abcdef1234567890\" --threshold 2 --shares 3\n\n# Split a 256-bit secret into multi-group shares\n# Create 2 groups: Group 1 (3-of-5) and Group 2 (2-of-3) - need 1 group to recover\ndotnet run --project Slip39.Console split --secret \"a1b2c3d4e5f67890abcdef1234567890fedcba0987654321a1b2c3d4e5f67890\" --group-threshold 1 --groups \"3-of-5,2-of-3\"\n\n# Multi-group requiring 2 out of 3 groups to recover\ndotnet run --project Slip39.Console split --secret \"a1b2c3d4e5f67890abcdef1234567890fedcba0987654321a1b2c3d4e5f67890\" --group-threshold 2 --groups \"2-of-3,3-of-5,1-of-1\" --passphrase \"mypassword\"\n\n# Combine shares to recover secret\ndotnet run --project Slip39.Console combine \"share1\" \"share2\"\n\n# Combine shares and show BIP32 master key\ndotnet run --project Slip39.Console combine --bip32 \"share1\" \"share2\"\n```\n\n### BIP32 Extended Private Key Support\n\n```bash\n# Split a BIP32 extended private key (xprv) into SLIP-0039 shares\ndotnet run --project Slip39.Console split-xpriv --xpriv \"xprv9s21ZrQH143K...\" --threshold 2 --shares 3\n\n# Split with custom passphrase and multi-group configuration\ndotnet run --project Slip39.Console split-xpriv --xpriv \"xprv9s21ZrQH143K...\" --group-threshold 2 --groups \"2-of-3,3-of-5\" --passphrase \"mypassword\"\n\n# Combine shares to recover the original BIP32 extended private key\ndotnet run --project Slip39.Console combine --bip32 \"share1\" \"share2\"\n```\n\n### Share Management\n\n```bash\n# Get detailed information about a share\ndotnet run --project Slip39.Console info \"share_mnemonic\"\n\n# Validate share checksums\ndotnet run --project Slip39.Console validate \"share1\" \"share2\" \"share3\"\n\n# Generate random secret and split into shares\ndotnet run --project Slip39.Console generate --bits 256 --threshold 2 --shares 3\n\n# Generate with BIP32 master key output\ndotnet run --project Slip39.Console generate --bits 256 --threshold 2 --shares 3 --bip32 --show-secret\n```\n\nFor detailed CLI usage, see [Slip39.Console/README.md](Slip39.Console/README.md).\n\n## Security Considerations\n\n- **Cryptographic Compliance**: Implements SLIP-0039 specification exactly as defined\n- **Secure Memory**: Sensitive data is handled securely and cleared when possible\n- **Passphrase Protection**: Optional passphrase adds an additional layer of security\n- **Threshold Security**: Requires minimum number of shares to recover secrets\n- **Checksum Validation**: RS1024 checksums prevent corruption and detect errors\n\n⚠️ **Important**: Keep your mnemonic shares secure and backed up. Loss of shares below the threshold means permanent loss of your secret.\n\n## Testing\n\nThe project includes comprehensive tests covering:\n- SLIP-0039 reference test vectors\n- BIP32 master key derivation\n- Cryptographic primitives (GF256, polynomial interpolation)\n- Error handling and edge cases\n- CLI functionality\n\n```bash\n# Run all tests\ndotnet test\n\n# Run with coverage\ndotnet test --collect:\"XPlat Code Coverage\"\n```\n\n## Requirements\n\n- .NET 9.0 or later\n- Supported platforms: Windows, Linux, macOS\n\n## Contributing\n\nContributions are welcome! Please:\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes with tests\n4. Ensure all tests pass\n5. Submit a pull request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Specification\n\nThis implementation follows the [SLIP-0039](https://github.com/satoshilabs/slips/blob/master/slip-0039.md) specification published by SatoshiLabs.\n\n## Acknowledgments\n\n- SatoshiLabs for the SLIP-0039 specification\n- The Bitcoin community for BIP32 specification\n- Adi Shamir for Shamir's Secret Sharing algorithm\n\n## AI Development Disclaimer\n\n🤖 **This entire repository was completely vibe-coded using Warp AI Terminal Agent Mode.** Not a single line of code, comment, documentation, or ancillary file was edited manually. The entire SLIP-0039 .NET implementation, CLI application, tests, documentation, and project infrastructure were generated through AI-assisted development in the terminal.\n\n## Disclaimer\n\nThis software is provided as-is. While it implements the SLIP-0039 specification and passes all test vectors, users should thoroughly test and audit the code for their specific use cases. The authors are not responsible for any loss of funds or data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuper-e%2Fslip39dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuper-e%2Fslip39dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuper-e%2Fslip39dotnet/lists"}