{"id":15036267,"url":"https://github.com/shinji-san/secretsharingdotnet","last_synced_at":"2025-12-25T23:55:03.436Z","repository":{"id":36834406,"uuid":"197976059","full_name":"shinji-san/SecretSharingDotNet","owner":"shinji-san","description":"An C# implementation of Shamir's Secret Sharing","archived":false,"fork":false,"pushed_at":"2025-06-01T19:33:47.000Z","size":591,"stargazers_count":43,"open_issues_count":1,"forks_count":12,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-02T05:47:03.831Z","etag":null,"topics":["cryptography","csharp","csharp-library","dotnet","dotnet-core","dotnet-framework","mit-license","secret-sharing","shamir-secret-sharing"],"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/shinji-san.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null}},"created_at":"2019-07-20T20:02:46.000Z","updated_at":"2025-05-10T14:36:22.000Z","dependencies_parsed_at":"2023-01-17T05:30:55.192Z","dependency_job_id":"76c5255d-eda5-4276-a43d-84615a976d6f","html_url":"https://github.com/shinji-san/SecretSharingDotNet","commit_stats":{"total_commits":509,"total_committers":4,"mean_commits":127.25,"dds":"0.10216110019646363","last_synced_commit":"3e67d44452628065a2756e40802bd5c9fa67fc0c"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/shinji-san/SecretSharingDotNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinji-san%2FSecretSharingDotNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinji-san%2FSecretSharingDotNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinji-san%2FSecretSharingDotNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinji-san%2FSecretSharingDotNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shinji-san","download_url":"https://codeload.github.com/shinji-san/SecretSharingDotNet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shinji-san%2FSecretSharingDotNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271500361,"owners_count":24770375,"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","status":"online","status_checked_at":"2025-08-21T02:00:08.990Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["cryptography","csharp","csharp-library","dotnet","dotnet-core","dotnet-framework","mit-license","secret-sharing","shamir-secret-sharing"],"created_at":"2024-09-24T20:30:40.186Z","updated_at":"2025-12-25T23:55:03.429Z","avatar_url":"https://github.com/shinji-san.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ✨ SecretSharingDotNet ✨\r\nA C# implementation of Shamir's Secret Sharing.\r\n\r\n# Build \u0026 Test Status Of Default Branch 👷\r\n\u003ctable\u003e\r\n  \u003cthead\u003e\r\n    \u003ctr\u003e\r\n        \u003cth\u003eStatus\u003c/th\u003e\r\n        \u003cth\u003eSolution\u003c/th\u003e\r\n        \u003cth\u003eProject Format\u003c/th\u003e\r\n        \u003cth\u003e.NET Version\u003c/th\u003e\r\n    \u003c/tr\u003e\r\n  \u003c/thead\u003e\r\n  \u003ctbody\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd rowspan=9\u003e\u003ca href =\"https://github.com/shinji-san/SecretSharingDotNet/actions/workflows/dotnetall.yml\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/shinji-san/SecretSharingDotNet/actions/workflows/dotnetall.yml/badge.svg?branch=main\" alt=\"Build status\"/\u003e\u003c/a\u003e\u003c/td\u003e\r\n          \u003ctd rowspan=9\u003e\u003ccode\u003eSecretSharingDotNet.slnx\u003c/code\u003e\u003c/td\u003e\r\n          \u003ctd rowspan=9\u003eSDK\u003c/td\u003e\r\n          \u003ctd\u003eStandard 2.0\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eStandard 2.1\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7.1\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7.2\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.8\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 8\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 9\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 10\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n  \u003c/tbody\u003e\r\n\u003c/table\u003e\r\n\r\n# NuGet 📦\r\n## Supported Target Frameworks\r\n\u003ctable\u003e\r\n  \u003cthead\u003e\r\n    \u003ctr\u003e\r\n        \u003cth\u003eBuild And Test Status\u003c/th\u003e\r\n        \u003cth\u003eNuGet Version\u003c/th\u003e\r\n        \u003cth\u003eGit Tag\u003c/th\u003e\r\n        \u003cth\u003eTarget Frameworks\u003c/th\u003e\r\n    \u003c/tr\u003e\r\n  \u003c/thead\u003e\r\n  \u003ctbody\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd rowspan=9\u003e\u003ca href=\"https://github.com/shinji-san/SecretSharingDotNet/actions/workflows/publishing.yml\" target=\"_blank\"\u003e\u003cimg src=\"https://github.com/shinji-san/SecretSharingDotNet/actions/workflows/publishing.yml/badge.svg\" alt=\"SecretSharingDotNet - NuGet Publishing\"/\u003e\u003c/a\u003e\u003c/td\u003e\r\n          \u003ctd rowspan=9\u003e\u003ca href=\"https://badge.fury.io/nu/SecretSharingDotNet\" target=\"_blank\"\u003e\u003cimg src=\"https://badge.fury.io/nu/SecretSharingDotNet.svg\" alt=\"NuGet Version 0.14.0\"/\u003e\u003c/a\u003e\u003c/td\u003e\r\n          \u003ctd rowspan=9\u003e\u003ca href=\"https://github.com/shinji-san/SecretSharingDotNet/tree/v0.14.0\" target=\"_blank\"\u003e\u003cimg src=\"https://img.shields.io/badge/SecretSharingDotNet-0.14.0-green.svg?logo=github\u0026logoColor=959da5\u0026color=2ebb4e\u0026labelColor=2b3137\" alt=\"Tag\"/\u003e\u003c/a\u003e\u003c/td\u003e\r\n          \u003ctd\u003eStandard 2.0\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eStandard 2.1\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7.1\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.7.2\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003eFX 4.8\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 8\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 9\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n      \u003ctr\u003e\r\n          \u003ctd\u003e.NET 10\u003c/td\u003e\r\n      \u003c/tr\u003e\r\n  \u003c/tbody\u003e\r\n\u003c/table\u003e\r\n\r\n## Install SecretSharingDotNet package 📥\r\n\r\n1. Open a console and switch to the directory, containing your project file.\r\n\r\n2. Use the following command to install version 0.14.0 of the SecretSharingDotNet package:\r\n\r\n    ```dotnetcli\r\n    dotnet add package SecretSharingDotNet -v 0.14.0 -f \u003cFRAMEWORK\u003e\r\n    ```\r\n\r\n3. After the completion of the command, look at the project file to make sure that the package is successfully installed.\r\n\r\n   You can open the `.csproj` file to see the added package reference:\r\n\r\n    ```xml\r\n    \u003cItemGroup\u003e\r\n      \u003cPackageReference Include=\"SecretSharingDotNet\" Version=\"0.14.0\" /\u003e\r\n    \u003c/ItemGroup\u003e\r\n    ```\r\n## Remove SecretSharingDotNet package 📤\r\n\r\n1. Open a console and switch to the directory, containing your project file.\r\n\r\n2. Use the following command to remove the SecretSharingDotNet package:\r\n\r\n    ```dotnetcli\r\n    dotnet remove package SecretSharingDotNet\r\n    ```\r\n\r\n3. After the completion of the command, look at the project file to make sure that the package is successfully removed.\r\n\r\n   You can open the `.csproj` file to check the deleted package reference.\r\n\r\n# Usage 🔧\r\n\u003e [!IMPORTANT]\r\n\u003e Breaking Change in v0.14.0: The string encoding in `SecretSharingDotNet` with text secrets is UTF-8.\r\n\r\n## Basics\r\nUse the function `MakeShares` to generate the shares, based on a random or pre-defined secret.\r\nAfterwards, use the function `Reconstruction` to re-construct the original secret.\r\n\r\nThe length of the shares is based on the security level. It is possible to pre-define a security level by `ctor` or the `SecurityLevel` property. The pre-defined security level will be overriden, if the secret size is greater than the Mersenne prime, which is calculated by means of the security level. It is not necessary to define a security level for a re-construction.\r\n\r\n## Using the SecretSharingDotNet library with DI in a .NET project.\r\nThis guide will demonstrate how to use the SecretSharingDotNet library with Dependency Injection (DI) in a .NET project.\r\n\r\nFirstly, add the following dependencies:\r\n```csharp\r\nusing Microsoft.Extensions.DependencyInjection;\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\nusing System.Numerics;\r\n```\r\nNext, initialize a `ServiceCollection` instance and add dependencies to the DI container:\r\n```csharp\r\nvar serviceCollection = new ServiceCollection();\r\nserviceCollection.AddSingleton\u003cIExtendedGcdAlgorithm\u003cBigInteger\u003e, ExtendedEuclideanAlgorithm\u003cBigInteger\u003e\u003e();\r\nserviceCollection.AddSingleton\u003cIMakeSharesUseCase\u003cBigInteger\u003e, SecretSplitter\u003cBigInteger\u003e\u003e();\r\nserviceCollection.AddSingleton\u003cIReconstructionUseCase\u003cBigInteger\u003e, SecretReconstructor\u003cBigInteger\u003e\u003e();\r\nusing var serviceProvider = serviceCollection.BuildServiceProvider();\r\n```\r\nIn the code above, the `ServiceCollection` registers an implementation for each of the main components of the SecretSharingDotNet library.\r\n\r\nNext, create an instance of the `IMakeSharesUseCase\u003cBigInteger\u003e`:\r\n```csharp\r\nvar makeSharesUseCase = serviceProvider.GetRequiredService\u003cIMakeSharesUseCase\u003cBigInteger\u003e\u003e();\r\n```\r\nUsing this instance, it is possible to create shares from a secret:\r\n```csharp\r\nvar shares = makeSharesUseCase.MakeShares(3, 7, \"Hello!\");\r\nConsole.WriteLine(shares);\r\n```\r\nSimilarly, an instance of `IReconstructionUseCase\u003cBigInteger\u003e` can be created to rebuild the original secret:\r\n```csharp\r\nvar reconstructionUseCase = serviceProvider.GetRequiredService\u003cIReconstructionUseCase\u003cBigInteger\u003e\u003e();\r\nvar reconstruction = reconstructionUseCase.Reconstruction(shares.Where(p =\u003e p.IsIndexEven).ToArray());\r\nConsole.WriteLine(reconstruction);\r\n```\r\n\r\nThe code above reconstructs the original secret from the shares, and then outputs it.\r\n\r\n## Random secret 🎲\r\nCreate a random secret in conjunction with the generation of shares. The length of the generated shares and of the secret are based on the security level. Here is an example with a pre-defined security level of 127:\r\n```csharp\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\n\r\nnamespace Example1\r\n{\r\n  public class Program\r\n  {\r\n    public static void Main(string[] args)\r\n    {\r\n      //// Create Shamir's Secret Sharing instance with BigInteger\r\n      var splitter = new SecretSplitter\u003cBigInteger\u003e();\r\n\r\n      //// Minimum number of shared secrets for reconstruction: 3\r\n      //// Maximum number of shared secrets: 7\r\n      //// Security level: 127 (Mersenne prime exponent)\r\n      var shares = splitter.MakeShares(3, 7, 127, out var secret);\r\n\r\n      //// Secret as big integer number\r\n      Console.WriteLine((BigInteger)secret);\r\n\r\n      //// Secret as base64 string\r\n      Console.WriteLine(secret.ToBase64());\r\n\r\n      var gcd = new ExtendedEuclideanAlgorithm\u003cBigInteger\u003e();\r\n      //// The 'shares' instance contains the shared secrets\r\n      var combiner = new SecretReconstructor\u003cBigInteger\u003e(gcd);\r\n      var subSet1 = shares.Where(p =\u003e p.IsIndexEven).ToList();\r\n      var recoveredSecret1 = combiner.Reconstruction(subSet1.ToArray());\r\n      var subSet2 = shares.Where(p =\u003e p.IsIndexOdd).ToList();\r\n      var recoveredSecret2 = combiner.Reconstruction(subSet2.ToArray());\r\n\r\n      //// String representation of all shares\r\n      Console.WriteLine(shares);\r\n\r\n      //// 1st recovered secret as big integer number\r\n      Console.WriteLine((BigInteger)recoveredSecret1);\r\n\r\n      //// 2nd recovered secret as big integer number\r\n      Console.WriteLine((BigInteger)recoveredSecret2);\r\n\r\n      //// 1st recovered secret as base64 string\r\n      Console.WriteLine(recoveredSecret1.ToBase64());\r\n\r\n      //// 2nd recovered secret as base64 string\r\n      Console.WriteLine(recoveredSecret2.ToBase64());\r\n    }\r\n  }\r\n}\r\n```\r\n## Pre-defined secret: text 📄\r\nUse a text as secret, which can be divided into shares. The length of the generated shares is based on the security level.\r\nHere is an example with auto-detected security level:\r\n```csharp\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\n\r\nnamespace Example2\r\n{\r\n  public class Program\r\n  {\r\n    public static void Main(string[] args)\r\n    {\r\n      //// Create Shamir's Secret Sharing instance with BigInteger\r\n      var splitter = new SecretSplitter\u003cBigInteger\u003e();\r\n\r\n      string password = \"Hello World!!\";\r\n      //// Minimum number of shared secrets for reconstruction: 3\r\n      //// Maximum number of shared secrets: 7\r\n      //// Attention: The password length can change the security level set by the ctor\r\n      //// or SecurityLevel property.\r\n      var shares = splitter.MakeShares(3, 7, password);\r\n\r\n      var gcd = new ExtendedEuclideanAlgorithm\u003cBigInteger\u003e();\r\n      //// The 'shares' instance contains the shared secrets\r\n      var combiner = new SecretReconstructor\u003cBigInteger\u003e(gcd);\r\n      var subSet1 = shares.Where(p =\u003e p.IsIndexEven).ToList();\r\n      var recoveredSecret1 = combiner.Reconstruction(subSet1.ToArray());\r\n      var subSet2 = shares.Where(p =\u003e p.IsIndexOdd).ToList();\r\n      var recoveredSecret2 = combiner.Reconstruction(subSet2.ToArray());\r\n\r\n      //// String representation of all shares\r\n      Console.WriteLine(shares);\r\n\r\n      //// 1st recovered secret as string (not base64!)\r\n      Console.WriteLine(recoveredSecret1);\r\n\r\n      //// 2nd recovered secret as string (not base64!)\r\n      Console.WriteLine(recoveredSecret2);\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## Pre-defined secret: number 🔢\r\nUse an integer number as secret, which can be divided into shares. The length of the generated shares is based on the security level.\r\nHere is an example with a pre-defined security level of 521:\r\n```csharp\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\n\r\nnamespace Example3\r\n{\r\n  public class Program\r\n  {\r\n    public static void Main(string[] args)\r\n    {\r\n      //// Create Shamir's Secret Sharing instance with BigInteger\r\n      //// and \r\n      var splitter = new SecretSplitter\u003cBigInteger\u003e();\r\n\r\n      BigInteger number = 20000;\r\n      //// Minimum number of shared secrets for reconstruction: 3\r\n      //// Maximum number of shared secrets: 7\r\n      //// Security level: 521 (Mersenne prime exponent)\r\n      //// Attention: The size of the number can change the security level set by the ctor\r\n      //// or SecurityLevel property.\r\n      var shares = splitter.MakeShares (3, 7, number, 521);\r\n\r\n      var gcd = new ExtendedEuclideanAlgorithm\u003cBigInteger\u003e();\r\n      ////  The 'shares' instance contains the shared secrets\r\n      var combiner = new SecretReconstructor\u003cBigInteger\u003e(gcd);\r\n      var subSet1 = shares.Where(p =\u003e p.IsIndexEven).ToList();\r\n      var recoveredSecret1 = combiner.Reconstruction(subSet1.ToArray());\r\n      var subSet2 = shares.Where(p =\u003e p.IsIndexOdd).ToList();\r\n      var recoveredSecret2 = combiner.Reconstruction(subSet2.ToArray());\r\n\r\n      //// String representation of all shares\r\n      Console.WriteLine(shares);\r\n\r\n      //// 1st recovered secret as big integer number\r\n      Console.WriteLine((BigInteger)recoveredSecret1);\r\n\r\n      //// 2nd recovered secret as big integer number\r\n      Console.WriteLine((BigInteger)recoveredSecret2);\r\n    }\r\n  }\r\n}\r\n```\r\n## Pre-defined secret: byte array ▦\r\nUse a byte array as secret, which can be divided into shares. The length of the generated shares is based on the security level.\r\nHere is an example with auto-detected security level:\r\n```csharp\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\n\r\nnamespace Example4\r\n{\r\n  public class Program\r\n  {\r\n    public static void Main(string[] args)\r\n    {\r\n      //// Create Shamir's Secret Sharing instance with BigInteger\r\n      var splitter = new SecretSplitter\u003cBigInteger\u003e();\r\n\r\n      byte[] bytes = { 0x1D, 0x2E, 0x3F };\r\n      //// Minimum number of shared secrets for reconstruction: 4\r\n      //// Maximum number of shared secrets: 10\r\n      //// Attention: The password length changes the security level set by the ctor\r\n      var shares = splitter.MakeShares(4, 10, bytes);\r\n\r\n      var gcd = new ExtendedEuclideanAlgorithm\u003cBigInteger\u003e();\r\n      //// The 'shares' instance contains the shared secrets\r\n      var combiner = new SecretReconstructor\u003cBigInteger\u003e(gcd);\r\n      var subSet = shares.Where(p =\u003e p.IsIndexEven).ToList();\r\n      var recoveredSecret = combiner.Reconstruction(subSet.ToArray()).ToByteArray();\r\n\r\n      //// String representation of all shares\r\n      Console.WriteLine(shares);\r\n\r\n      //// The secret bytes.\r\n      Console.WriteLine($\"{recoveredSecret[0]:X2}, {recoveredSecret[1]:X2}, {recoveredSecret[2]:X2}\");\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n## Shares 🔑\r\nThe following example shows three ways to use shares to reconstruct a secret:\r\n```csharp\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Linq;\r\nusing System.Numerics;\r\n\r\nusing SecretSharingDotNet.Cryptography;\r\nusing SecretSharingDotNet.Cryptography.ShamirsSecretSharing;\r\nusing SecretSharingDotNet.Math;\r\n\r\nnamespace Example5\r\n{\r\n  public class Program\r\n  {\r\n    public static void Main(string[] args)\r\n    {\r\n      //// One way to use shares\r\n      string shares1 = \"02-665C74ED38FDFF095B2FC9319A272A75\" + Environment.NewLine +\r\n                       \"05-CDECB88126DBC04D753E0C2D83D7B55D\" + Environment.NewLine +\r\n                       \"07-54A83E34AB0310A7F5D80F2A68FD4F33\";\r\n\r\n      //// A 2nd way to use shares\r\n      string[] shares2 = {\"02-665C74ED38FDFF095B2FC9319A272A75\",\r\n                          \"07-54A83E34AB0310A7F5D80F2A68FD4F33\",\r\n                          \"05-CDECB88126DBC04D753E0C2D83D7B55D\"};\r\n\r\n      //// Another way to use shares\r\n      var share1 = new Share\u003cBigInteger\u003e(\"05-CDECB88126DBC04D753E0C2D83D7B55D\");\r\n      var share2 = new Share\u003cBigInteger\u003e(\"07-54A83E34AB0310A7F5D80F2A68FD4F33\");\r\n      var share3 = new Share\u003cBigInteger\u003e(\"02-665C74ED38FDFF095B2FC9319A272A75\");\r\n\r\n      var gcd = new ExtendedEuclideanAlgorithm\u003cBigInteger\u003e();\r\n      var combiner = new SecretReconstructor\u003cBigInteger\u003e(gcd);\r\n \r\n      var recoveredSecret1 = combiner.Reconstruction(shares1);\r\n      //// Output should be 52199147989510990914370102003412153\r\n      Console.WriteLine((BigInteger)recoveredSecret1);\r\n\r\n      var recoveredSecret2 = combiner.Reconstruction(shares2);\r\n      //// Output should be 52199147989510990914370102003412153\r\n      Console.WriteLine((BigInteger)recoveredSecret2);\r\n\r\n      //// Output should be 52199147989510990914370102003412153\r\n      var recoveredSecret3 = combiner.Reconstruction(share1, share2, share3);\r\n      Console.WriteLine((BigInteger)recoveredSecret3);\r\n    }\r\n  }\r\n}\r\n```\r\n\r\n# CLI building instructions\r\n## Prerequisites\r\nFor the following instructions, please make sure that you are connected to the internet. If necessary, NuGet will try to restore the [xUnit](https://xunit.net/) packages.\r\n\r\nIf you start the unit tests on Linux, you must install the `mono-complete` package in case of the .NET Frameworks 4.7, 4.7.1, 4.7.2, 4.8 and 4.8.1.\r\nYou can find the Mono installation instructions [here](https://www.mono-project.com/download/stable/#download-lin).\r\n\r\nThe .NET Frameworks 4.7, 4.7.1, 4.7.2, 4.8 and 4.8.1 can be found [here](https://dotnet.microsoft.com/download/dotnet-framework).\r\n\r\nThe .NET SDKs 8.0, 9.0 and 10.0 can be found [here](https://dotnet.microsoft.com/download/dotnet).\r\n\r\n## Build and test the solution\r\nYou can use the `SecretSharingDotNet.sln` solution file with the `dotnet` command to build the [SecretSharingDotNet](#secretsharingdotnet) library in the `Debug` or `Release` configuration. You can also use the `dotnet` command to start the unit tests.\r\n\r\n### 1. Restore NuGet packages\r\n\r\n```dotnetcli\r\ndotnet restore SecretSharingDotNet.sln\r\n```\r\n\r\n### 2. Build the solution\r\n\r\n```dotnetcli\r\ndotnet build -c Debug --no-restore SecretSharingDotNet.sln\r\n```\r\n\r\nor\r\n\r\n```dotnetcli\r\ndotnet build -c Release --no-restore SecretSharingDotNet.sln\r\n```\r\n\r\n### 3. Test the solution\r\n\r\n```dotnetcli\r\ndotnet test -c Debug --no-restore --no-build SecretSharingDotNet.sln -- RunConfiguration.TargetPlatform=x64 RunConfiguration.MaxCpuCount=1  xUnit.AppDomain=denied xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false\r\n```\r\n\r\nor \r\n\r\n```dotnetcli\r\ndotnet test -c Release --no-restore --no-build SecretSharingDotNet.sln -- RunConfiguration.TargetPlatform=x64 RunConfiguration.MaxCpuCount=1  xUnit.AppDomain=denied xUnit.ParallelizeAssembly=false xUnit.ParallelizeTestCollections=false\r\n```\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinji-san%2Fsecretsharingdotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshinji-san%2Fsecretsharingdotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshinji-san%2Fsecretsharingdotnet/lists"}