Skip to content

Commit

Permalink
bump BigIntegerExt so it generates pseudo primes of exact given bit l…
Browse files Browse the repository at this point in the history
…ength
  • Loading branch information
bazzilic committed Dec 7, 2021
1 parent a8f59ac commit 4fea929
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/Aprismatic.ElGamalExt/Aprismatic.ElGamalExt.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aprismatic.BigFraction" Version="0.1.5" />
<PackageReference Include="Aprismatic.BigIntegerExt" Version="0.1.6" />
<PackageReference Include="Aprismatic.BigIntegerExt" Version="0.1.7" />
<PackageReference Include="Aprismatic.ElGamalExt.Homomorphism" Version="0.10.2" />
<PackageReference Include="System.Threading.Channels" Version="5.0.0" />
<PackageReference Include="System.Threading.Channels" Version="6.0.0" />
</ItemGroup>
</Project>
5 changes: 1 addition & 4 deletions src/Aprismatic.ElGamalExt/ElGamal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ private ElGamalKeyStruct CreateKeyPair(int maxptbits) // TODO: This method shoul
// Generate a large safe prime number P, and regenerate P when it is not same as KeySize in bytes
do
{
do
{
Q = BigInteger.Zero.GenPseudoPrime(KeySizeValue - 1, 16, rng);
} while (Q.BitCount() != KeySizeValue - 1);
Q = BigInteger.Zero.GenPseudoPrime(KeySizeValue - 1, 16, rng);
PminusOne = bitwo * Q;
P = PminusOne + BigInteger.One;
} while (P.BitCount() != KeySizeValue && !P.IsProbablePrime(16));
Expand Down
2 changes: 1 addition & 1 deletion test/ElGamalTests/ElGamalTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
Expand Down

0 comments on commit 4fea929

Please sign in to comment.