Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release - v0.12.0 #236

Merged
merged 48 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
9400b07
Merge pull request #203 from shinji-san/hotfix-PublishingPipeline
shinji-san Dec 30, 2023
335adc2
Bump Microsoft.NET.Test.Sdk and Microsoft.TestPlatform.ObjectModel
dependabot[bot] Feb 12, 2024
82c94fe
Merge pull request #206 from shinji-san/dependabot/nuget/develop/Micr…
shinji-san Feb 23, 2024
6aa820f
Bump xunit from 2.6.4 to 2.7.0
dependabot[bot] Feb 23, 2024
725a7cc
Merge pull request #209 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Feb 23, 2024
e7ac552
Bump xunit.runner.visualstudio from 2.5.6 to 2.5.7
dependabot[bot] Feb 23, 2024
5d76a79
Merge pull request #208 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Feb 23, 2024
b649e3b
Bump xunit from 2.7.0 to 2.8.0
dependabot[bot] Apr 29, 2024
4ebf743
Merge pull request #212 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san May 23, 2024
554d79b
Bump xunit.runner.visualstudio from 2.5.7 to 2.8.0
dependabot[bot] May 23, 2024
9df44e3
Merge pull request #213 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san May 23, 2024
0b10624
Bump Microsoft.NET.Test.Sdk and Microsoft.TestPlatform.ObjectModel
dependabot[bot] May 27, 2024
752b3aa
Merge pull request #214 from shinji-san/dependabot/nuget/develop/mult…
shinji-san Jun 2, 2024
b9e2688
Bump xunit from 2.8.0 to 2.8.1
dependabot[bot] Jun 2, 2024
b4dbd2d
Merge pull request #216 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Jun 2, 2024
661fcfc
Bump xunit.runner.visualstudio from 2.8.0 to 2.8.1
dependabot[bot] Jun 3, 2024
0feb8f6
Merge pull request #217 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Jun 27, 2024
969719c
.NET 7 Support: Removed
shinji-san Jun 27, 2024
d3df3ca
Merge pull request #218 from shinji-san/remove-DotNet7Support
shinji-san Jun 27, 2024
d8cb5da
Bump xunit from 2.8.1 to 2.9.0
dependabot[bot] Jul 15, 2024
c5d82b2
Merge pull request #219 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Aug 25, 2024
92dc463
Bump xunit.runner.visualstudio from 2.8.1 to 2.8.2
dependabot[bot] Aug 25, 2024
8e376d1
Merge pull request #220 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Aug 25, 2024
ae0234c
Bump Microsoft.NET.Test.Sdk and Microsoft.TestPlatform.ObjectModel
dependabot[bot] Aug 26, 2024
dbed77a
Merge pull request #222 from shinji-san/dependabot/nuget/develop/mult…
shinji-san Aug 30, 2024
948d7c4
Bump actions/setup-dotnet from 4.0.0 to 4.0.1
dependabot[bot] Aug 30, 2024
c6d8526
Merge pull request #221 from shinji-san/dependabot/github_actions/dev…
shinji-san Aug 30, 2024
2a30eb8
IMakeSharesUseCase & IReconstructionUseCase: Initial import
shinji-san Jun 27, 2024
31b5a74
Merge pull request #223 from shinji-san/feature-UseCaseInterfaceForDi
shinji-san Aug 30, 2024
59e9b74
GitHub Workflows: Remove .NET 7 setup
shinji-san Aug 30, 2024
889ecd4
Merge pull request #224 from shinji-san/fix-WorkflowWithDotNet7Setup
shinji-san Aug 30, 2024
321fca4
Bump Microsoft.TestPlatform.ObjectModel from 17.11.0 to 17.11.1
dependabot[bot] Sep 9, 2024
64cc7e4
Merge pull request #225 from shinji-san/dependabot/nuget/develop/Micr…
shinji-san Sep 11, 2024
4e34ca6
Bump Microsoft.NET.Test.Sdk from 17.11.0 to 17.11.1
dependabot[bot] Sep 16, 2024
06c0ea1
Merge pull request #226 from shinji-san/dependabot/nuget/develop/Micr…
shinji-san Sep 22, 2024
a357755
Bump xunit from 2.9.0 to 2.9.1
dependabot[bot] Sep 23, 2024
bc71ad3
Merge pull request #227 from shinji-san/dependabot/nuget/develop/xuni…
shinji-san Sep 23, 2024
c58b666
Refactor visibility and syntax in Calculator classes
shinji-san Sep 22, 2024
cb3bc34
Merge pull request #229 from shinji-san/fix-SqrtSignatur
shinji-san Sep 23, 2024
71225a6
Bump actions/setup-dotnet from 4.0.1 to 4.1.0
dependabot[bot] Oct 28, 2024
97ec1af
Merge pull request #231 from shinji-san/dependabot/github_actions/dev…
shinji-san Nov 17, 2024
4e4df85
Bump Microsoft.NETFramework.ReferenceAssemblies and xunit
dependabot[bot] Nov 17, 2024
09b0aa5
Merge pull request #233 from shinji-san/dependabot/nuget/develop/mult…
shinji-san Nov 17, 2024
1cbe243
.NET 6 Support: Removed
shinji-san Nov 17, 2024
138e56f
Merge pull request #234 from shinji-san/remove-DotNet6Support
shinji-san Nov 17, 2024
fca5e02
.NET 9 Support: Added
shinji-san Nov 17, 2024
2211917
Merge pull request #235 from shinji-san/feature-DotNet9Support
shinji-san Nov 17, 2024
2412d05
Bump version: [v0.12.0]
shinji-san Nov 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 7 additions & 12 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,19 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup .NET 6
uses: actions/[email protected]
with:
dotnet-version: 6.0.416

- name: Setup .NET 7
uses: actions/[email protected]
- name: Setup .NET 8
uses: actions/[email protected]
with:
dotnet-version: 7.0.403
dotnet-version: 8.0.404

- name: Setup .NET 8
uses: actions/setup-dotnet@v4.0.0
- name: Setup .NET 9
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: .NET Core SxS
run: |
rsync -a ${DOTNET_ROOT/8.0.100/7.0.403/6.0.416}/* $DOTNET_ROOT/
rsync -a ${DOTNET_ROOT/8.0.404/9.0.100}/* $DOTNET_ROOT/

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/dotnetall.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup .NET 6
uses: actions/[email protected]
with:
dotnet-version: 6.0.416

- name: Setup .NET 7
uses: actions/[email protected]
- name: Setup .NET 8
uses: actions/[email protected]
with:
dotnet-version: 7.0.403
dotnet-version: 8.0.404

- name: Setup .NET 8
uses: actions/setup-dotnet@v4.0.0
- name: Setup .NET 9
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Restore
run: dotnet restore SecretSharingDotNet.sln
Expand Down
17 changes: 6 additions & 11 deletions .github/workflows/publishing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,15 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup .NET 6
uses: actions/[email protected]
with:
dotnet-version: 6.0.416

- name: Setup .NET 7
uses: actions/[email protected]
- name: Setup .NET 8
uses: actions/[email protected]
with:
dotnet-version: 7.0.403
dotnet-version: 8.0.404

- name: Setup .NET 8
uses: actions/setup-dotnet@v4.0.0
- name: Setup .NET 9
uses: actions/setup-dotnet@v4.1.0
with:
dotnet-version: 8.0.100
dotnet-version: 9.0.100

- name: Decrypt large secret
run: ./.github/secrets/decrypt_publisher_snk.sh
Expand Down
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.12.0] - 2024-11-17
### Added
- Added .NET 9.0 support
- Added use-case interfaces `IMakeSharesUseCase` and `IReconstructUseCase` to the `SecretSharingDotNet` project.
- Added a guide to the `README.md` file on how to use the use-case interfaces with dependency injection.

### Changed
- Changed the `Sqrt` signature in the `BigIntCalculator` class from property to method.
- Changed method visibility from `public` to `protected` in the `BigIntCalculator`and `Calculator` classes to restrict access.

### Removed
- Removed .NET 7 support, because it retires on May 14, 2024. See [.NET and .NET Core Support Policy](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core).
- Removed .NET 6 support, because it retires on November 12, 2024. See [.NET and .NET Core Support Policy](https://dotnet.microsoft.com/en-us/platform/support/policy/dotnet-core).

## [0.11.0] - 2023-12-30
### Added
- Added support for .NET FX v4.8.1
Expand Down Expand Up @@ -206,7 +220,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added `LICENSE.md`
- Added `README.md`

[Unreleased]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.11.0...develop
[Unreleased]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.12.0...develop
[0.12.0]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.11.0...v0.12.0
[0.11.0]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.10.2...v0.11.0
[0.10.2]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/shinji-san/SecretSharingDotNet/compare/v0.10.0...v0.10.1
Expand Down
74 changes: 53 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ An C# implementation of Shamir's Secret Sharing.
</thead>
<tbody>
<tr>
<td rowspan=10><a href ="https://github.com/shinji-san/SecretSharingDotNet/actions?query=workflow%3A%22SecretSharingDotNet+%28All+supported+TFM%29%22" target="_blank"><img src="https://github.com/shinji-san/SecretSharingDotNet/workflows/SecretSharingDotNet%20(All%20supported%20TFM)/badge.svg" alt="Build status"/></a></td>
<td rowspan=10><code>SecretSharingDotNet.sln</code></td>
<td rowspan=10>SDK</td>
<td rowspan=9><a href ="https://github.com/shinji-san/SecretSharingDotNet/actions?query=workflow%3A%22SecretSharingDotNet+%28All+supported+TFM%29%22" target="_blank"><img src="https://github.com/shinji-san/SecretSharingDotNet/workflows/SecretSharingDotNet%20(All%20supported%20TFM)/badge.svg" alt="Build status"/></a></td>
<td rowspan=9><code>SecretSharingDotNet.sln</code></td>
<td rowspan=9>SDK</td>
<td>Standard 2.0</td>
</tr>
<tr>
Expand All @@ -37,13 +37,10 @@ An C# implementation of Shamir's Secret Sharing.
<td>FX 4.8</td>
</tr>
<tr>
<td>.NET 6</td>
</tr>
<tr>
<td>.NET 7</td>
<td>.NET 8</td>
</tr>
<tr>
<td>.NET 8</td>
<td>.NET 9</td>
</tr>
</tbody>
</table>
Expand All @@ -61,9 +58,9 @@ An C# implementation of Shamir's Secret Sharing.
</thead>
<tbody>
<tr>
<td rowspan=10><a href="https://github.com/shinji-san/SecretSharingDotNet/actions?query=workflow%3A%22SecretSharingDotNet+NuGet%22" target="_blank"><img src="https://github.com/shinji-san/SecretSharingDotNet/workflows/SecretSharingDotNet%20NuGet/badge.svg?branch=v0.11.0" alt="SecretSharingDotNet NuGet"/></a></td>
<td rowspan=10><a href="https://badge.fury.io/nu/SecretSharingDotNet" target="_blank"><img src="https://badge.fury.io/nu/SecretSharingDotNet.svg" alt="NuGet Version 0.11.0"/></a></td>
<td rowspan=10><a href="https://github.com/shinji-san/SecretSharingDotNet/tree/v0.11.0" target="_blank"><img src="https://img.shields.io/badge/SecretSharingDotNet-0.11.0-green.svg?logo=github&logoColor=959da5&color=2ebb4e&labelColor=2b3137" alt="Tag"/></a></td>
<td rowspan=9><a href="https://github.com/shinji-san/SecretSharingDotNet/actions?query=workflow%3A%22SecretSharingDotNet+NuGet%22" target="_blank"><img src="https://github.com/shinji-san/SecretSharingDotNet/workflows/SecretSharingDotNet%20NuGet/badge.svg?branch=v0.12.0" alt="SecretSharingDotNet NuGet"/></a></td>
<td rowspan=9><a href="https://badge.fury.io/nu/SecretSharingDotNet" target="_blank"><img src="https://badge.fury.io/nu/SecretSharingDotNet.svg" alt="NuGet Version 0.12.0"/></a></td>
<td rowspan=9><a href="https://github.com/shinji-san/SecretSharingDotNet/tree/v0.12.0" target="_blank"><img src="https://img.shields.io/badge/SecretSharingDotNet-0.12.0-green.svg?logo=github&logoColor=959da5&color=2ebb4e&labelColor=2b3137" alt="Tag"/></a></td>
<td>Standard 2.0</td>
</tr>
<tr>
Expand All @@ -85,13 +82,10 @@ An C# implementation of Shamir's Secret Sharing.
<td>FX 4.8</td>
</tr>
<tr>
<td>.NET 6</td>
<td>.NET 8</td>
</tr>
<tr>
<td>.NET 7</td>
</tr>
<tr>
<td>.NET 8</td>
<td>.NET 9</td>
</tr>
</tbody>
</table>
Expand All @@ -100,10 +94,10 @@ An C# implementation of Shamir's Secret Sharing.

1. Open a console and switch to the directory, containing your project file.

2. Use the following command to install version 0.11.0 of the SecretSharingDotNet package:
2. Use the following command to install version 0.12.0 of the SecretSharingDotNet package:

```dotnetcli
dotnet add package SecretSharingDotNet -v 0.11.0 -f <FRAMEWORK>
dotnet add package SecretSharingDotNet -v 0.12.0 -f <FRAMEWORK>
```

3. After the completion of the command, look at the project file to make sure that the package is successfully installed.
Expand All @@ -112,7 +106,7 @@ An C# implementation of Shamir's Secret Sharing.

```xml
<ItemGroup>
<PackageReference Include="SecretSharingDotNet" Version="0.11.0" />
<PackageReference Include="SecretSharingDotNet" Version="0.12.0" />
</ItemGroup>
```
## Remove SecretSharingDotNet package
Expand All @@ -134,7 +128,45 @@ An C# implementation of Shamir's Secret Sharing.
Use the function `MakeShares` to generate the shares, based on a random or pre-defined secret.
Afterwards, use the function `Reconstruction` to re-construct the original secret.

The length of the shares is based on the security level. It's 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.
The 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.

## Using the SecretSharingDotNet library with DI in a .NET project.
This guide will demonstrate how to use the SecretSharingDotNet library with Dependency Injection (DI) in a .NET project.

Firstly, add the following dependencies:
```csharp
using Microsoft.Extensions.DependencyInjection;
using SecretSharingDotNet.Cryptography;
using SecretSharingDotNet.Math;
using System.Numerics;
```
Next, initialize a `ServiceCollection` instance and add dependencies to the DI container:
```csharp
var serviceCollection = new ServiceCollection();
serviceCollection.AddSingleton<IExtendedGcdAlgorithm<BigInteger>, ExtendedEuclideanAlgorithm<BigInteger>>();
serviceCollection.AddSingleton<IMakeSharesUseCase<BigInteger>, ShamirsSecretSharing<BigInteger>>();
serviceCollection.AddSingleton<IReconstructionUseCase<BigInteger>, ShamirsSecretSharing<BigInteger>>();
using var serviceProvider = serviceCollection.BuildServiceProvider();
```
In the code above, the `ServiceCollection` registers an implementation for each of the main components of the SecretSharingDotNet library.

Next, create an instance of the `IMakeSharesUseCase<BigInteger>`:
```csharp
var makeSharesUseCase = serviceProvider.GetRequiredService<IMakeSharesUseCase<BigInteger>>();
```
Using this instance, it is possible to create shares from a secret:
```csharp
var shares = makeSharesUseCase.MakeShares(3, 7, "Hello!");
Console.WriteLine(shares);
```
Similarly, an instance of `IReconstructionUseCase<BigInteger>` can be created to rebuild the original secret:
```csharp
var reconstructionUseCase = serviceProvider.GetRequiredService<IReconstructionUseCase<BigInteger>>();
var reconstruction = reconstructionUseCase.Reconstruction(shares.Where(p => p.X.IsEven).ToArray());
Console.WriteLine(reconstruction);
```

The code above reconstructs the original secret from the shares, and then outputs it.

## Random secret
Create 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:
Expand Down Expand Up @@ -409,7 +441,7 @@ You can find the Mono installation instructions [here](https://www.mono-project.

The .NET Frameworks 4.6.2, 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).

The .NET SDKs 6.0, 7.0 and 8.0 can be found [here](https://dotnet.microsoft.com/download/dotnet).
The .NET SDKs 8.0 and 9.0 can be found [here](https://dotnet.microsoft.com/download/dotnet).

## Build and test the solution
You 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.
Expand Down
33 changes: 16 additions & 17 deletions src/Cryptography/FinitePoint`1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
#endif
{
#if NET6_0_OR_GREATER
if (serialized == null || serialized.IsEmpty)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / build

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / build

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)

Check warning on line 87 in src/Cryptography/FinitePoint`1.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Comparing a span to 'null' might be redundant, the 'null' literal will be implicitly converted to a 'Span<T>.Empty' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2265)
#else
if (string.IsNullOrWhiteSpace(serialized))
#endif
Expand Down Expand Up @@ -154,45 +154,45 @@
/// </summary>
/// <param name="left">The left operand</param>
/// <param name="right">The right operand</param>
/// <returns>Returns <see langword="true"/> if its operands are not equal, otherwise <see langword="false"/>.</returns>
/// <returns>Returns <see langword="true"/> if its operands aren't equal, otherwise <see langword="false"/>.</returns>
public static bool operator !=(FinitePoint<TNumber> left, FinitePoint<TNumber> right) => !left.Equals(right);

/// <summary>
/// Greater than operator
/// </summary>
/// <param name="left">The 1st operand</param>
/// <param name="right">The 2nd operand</param>
/// <returns>Returns <see langword="true"/> if its 1st operand is greater than its 2nd operand, otherwise <see langword="false"/>.</returns>
/// <param name="left">The first operand</param>
/// <param name="right">The second operand</param>
/// <returns>Returns <see langword="true"/> if its first operand is greater than its second operand, otherwise <see langword="false"/>.</returns>
public static bool operator >(FinitePoint<TNumber> left, FinitePoint<TNumber> right) => left.CompareTo(right) == 1;

/// <summary>
/// Less than operator
/// </summary>
/// <param name="left">The 1st operand</param>
/// <param name="right">The 2nd operand</param>
/// <returns>Returns <see langword="true"/> if its 1st operand is less than its 2nd operand, otherwise <see langword="false"/>.</returns>
/// <param name="left">The first operand</param>
/// <param name="right">The second operand</param>
/// <returns>Returns <see langword="true"/> if its first operand is less than its second operand, otherwise <see langword="false"/>.</returns>
public static bool operator <(FinitePoint<TNumber> left, FinitePoint<TNumber> right) => left.CompareTo(right) == -1;

/// <summary>
/// Greater than or equal operator
/// </summary>
/// <param name="left">The 1st operand</param>
/// <param name="right">The 2nd operand</param>
/// <returns>Returns <see langword="true"/> if its 1st operand is greater than or equal to its 2nd operand, otherwise <see langword="false"/>.</returns>
/// <param name="right">The second operand</param>
/// <returns>Returns <see langword="true"/> if its first operand is greater than or equal to its second operand, otherwise <see langword="false"/>.</returns>
public static bool operator >=(FinitePoint<TNumber> left, FinitePoint<TNumber> right) => left.CompareTo(right) >= 0;

/// <summary>
/// Less than or equal operator
/// </summary>
/// <param name="left">The 1st operand</param>
/// <param name="right">The 2nd operand</param>
/// <returns>Returns <see langword="true"/> if its 1st operand is less than or equal to its 2nd operand, otherwise <see langword="false"/>.</returns>
/// <param name="left">The first operand</param>
/// <param name="right">The second operand</param>
/// <returns>Returns <see langword="true"/> if its first operand is less than or equal to its second operand, otherwise <see langword="false"/>.</returns>
public static bool operator <=(FinitePoint<TNumber> left, FinitePoint<TNumber> right) => left.CompareTo(right) <= 0;

/// <inheritdoc />
public int CompareTo(FinitePoint<TNumber> other)
{
return ((this.X.Pow(2) + this.Y.Pow(2)).Sqrt - (other.X.Pow(2) + other.Y.Pow(2)).Sqrt).Sign;
return ((this.X.Pow(2) + this.Y.Pow(2)).Sqrt() - (other.X.Pow(2) + other.Y.Pow(2)).Sqrt()).Sign;
}

/// <summary>
Expand Down Expand Up @@ -251,7 +251,7 @@
/// Converts a byte collection to hexadecimal string.
/// </summary>
/// <param name="bytes"></param>
/// <returns>human readable / printable string</returns>
/// <returns>human-readable / printable string</returns>
/// <remarks>
/// Based on discussion on <see href="https://stackoverflow.com/questions/623104/byte-to-hex-string/5919521#5919521">stackoverflow</see>
/// </remarks>
Expand Down Expand Up @@ -287,8 +287,7 @@
private static byte[] ToByteArray(string hexString)
{
byte[] bytes = new byte[hexString.Length / 2];
var hexValues = Array.AsReadOnly(new[]
{
var hexValues = Array.AsReadOnly([
0x00,
0x01,
0x02,
Expand All @@ -312,7 +311,7 @@
0x0D,
0x0E,
0x0F
});
]);

for (int i = 0, j = 0; j < hexString.Length; j += 2, i += 1)
{
Expand Down
Loading