︠6812a6b0-e986-430b-adeb-060428b504dci︠
%html
Initial Segment Attack
︡ee30688f-579b-4da6-9f4f-710ee4603e7f︡{"done":true,"html":"Initial Segment Attack
"}
︠c29ed099-f19c-40e4-81bc-3f83a72257b6i︠
%md
Description. The main idea of this attack is to compute the value $x=(R-(R \mod 10^j))/10^j$ for j=1, 2, ... k where k is the number of tdigits of the modulus R and each step to find gcd(x, R). The attack works if R is a product of two primes such that one of the primes has many consecutive zeros and the otheprime is relatively small.
︡67a4f801-bca7-4a53-b3d1-964bb676aa91︡{"done":true,"md":"Description. The main idea of this attack is to compute the value $x=(R-(R \\mod 10^j))/10^j$ for j=1, 2, ... k where k is the number of tdigits of the modulus R and each step to find gcd(x, R). The attack works if R is a product of two primes such that one of the primes has many consecutive zeros and the otheprime is relatively small."}
︠b347f093-a222-48eb-8d8e-2d12c4688550s︠
####################################################################################################################################
# The ISAttack uses only one input - the modulus R. If successful, the function provides only one of the primes. #
####################################################################################################################################
def ISAttack (R):
R = ZZ(R)
n = R.ndigits()
for j in range(1, n + 1):
x=(R-(R % 10^j))/10^j
p = gcd(x, R)
if ((1 < p)and (p