Check Pollard Rho deadline inside partial factor loop
This commit is contained in:
1 parent
4917f690fc
commit
b7c187bbc5
1 file changed
+10
@@ -873,6 +873,13 @@ internal static partial class PrimeOrderCalculator
|
|||||||
{
|
{
|
||||||
while (compositeStack.Count > 0)
|
while (compositeStack.Count > 0)
|
||||||
{
|
{
|
||||||
|
long currentTimestamp = Stopwatch.GetTimestamp();
|
||||||
|
if (currentTimestamp > deadlineTimestamp)
|
||||||
|
{
|
||||||
|
pollardRhoDeadlineReached = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ulong composite = compositeStack.Pop();
|
ulong composite = compositeStack.Pop();
|
||||||
// composite will never be smaller than 1 on the execution path
|
// composite will never be smaller than 1 on the execution path
|
||||||
// if (composite <= 1UL)
|
// if (composite <= 1UL)
|
||||||
@@ -899,8 +906,11 @@ internal static partial class PrimeOrderCalculator
|
|||||||
compositeStack.Push(quotient);
|
compositeStack.Push(quotient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!pollardRhoDeadlineReached)
|
||||||
|
{
|
||||||
pollardRhoDeadlineReached = Stopwatch.GetTimestamp() > deadlineTimestamp;
|
pollardRhoDeadlineReached = Stopwatch.GetTimestamp() > deadlineTimestamp;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pollardRhoDeadlineReached)
|
if (pollardRhoDeadlineReached)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user