Skip to content

Conversation

@Alb4don
Copy link

@Alb4don Alb4don commented Oct 20, 2025

  • The original script failed for moduli above 300 bits due to naive search failures. Here, we resort to Pollard's Rho, a probabilistic method based on cycle detection that is more effective for semiprimes, preserving the NN for quick gains on small keys.

  • Now, the load_data_and_model function will load factor pairs stored in JSON (n {p, q}), falling back to the default sequential model if .h5 is missing. The update_model_and_data function will add new data only for n < 2^53 (avoiding loss of floating-point precision); it retrains on subsets with 50 epochs. Batch_size=min(32,data_len) saves the model after fitting.

  • Another improvement implements the Brent variant of Pollard's Rho with cycle detection via the tortoise-hare (x, y advances). This limits iterations to 1M per attempt to avoid crashes, and uses math.gcd for divisor checks. The factor_with_rho function will orchestrate the trial division up to 10K for small factors and then execute Rho in parallel. Returning ordered (p, q) only after the Miller-Rabin primality check.

512-bit semiprimes are expected to be successfully factored in <10s on average (tested using synthetic keys, e.g., p=next_prime(2^256), q=next_prime(2^256 + 2^100)). It also returns errors in primes or failures, which will increase reliability.

RSAA

…s, parallel processing, and adaptive NN training

 - The original script failed for moduli above 300 bits due to naive search failures. Here, we resort to Pollard's Rho, a probabilistic method based on cycle detection that is more effective for semiprimes, preserving the NN for quick gains on small keys.

- Now, the load_data_and_model function will load factor pairs stored in JSON (n  {p, q}), falling back to the default sequential model if .h5 is missing. The update_model_and_data function will add new data only for n < 2^53 (avoiding loss of floating-point precision); it retrains on subsets with 50 epochs. Batch_size=min(32,data_len) saves the model after fitting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant