Fermat Attack
Description. This attack takes advantage of the difference of squares theorem. If the two primes used for RSA are close together it will be able to produce one of the primes as an output. This algorithm is deterministic meaning it will find a solution but is efficent only if the difference of the primes is small
Example. One case where the fermat attack should find the correct prime in one round
n is 392978654845729289907021754452182325881346071758898433529538362675031664460938682805318112640661164293937049338385443383663702038544055748284664168992544981428408893033338462355487676707091259638157494641830935147650581928069288556483290429263378443463703
Factor found in round 1
one of the primes is 19823689233987938247938274983309283029130218032845987439578439857389275997598441027803118841872484057442928728490226128152255489
the other prime is 19823689233987938247938274983309283029130218032845987439578439857389275987598437592345678984375000100012345678909876543216789527
Example. One case where the fermat attack will find one of the primes after about 5000 rounds
Factor found in round 5329
2345672345678234577823456782345678345893L