```##################
# rsacrack.bdscr #
##################
println("Three public modulus values, 512 bits each...")
n1=0xa9c737dd808d02866fbf1acf05de2eb124137007a4965ec4dcbfa6d02f97e0123a8fd3691e414a1382f38ab39b09975705eceaf1131a283c937b309f1c1417f9
n3=0xc2bdbd4e36ba20d37d5d1e968f09f2fc7b41a97f3052274e4892d50d5fb337c923048aed7d393135ee55711e5c74975867f13d3845bac9588b4be170d08bab57
println("n1=", hex(n1))
println("n2=", hex(n2))
println("n3=", hex(n3))
# Common public exponent
e=3
println("Common public exponent, e=", e)
# Message to be encrypted...
println("Message, m=", hex(m))
# Compute three ciphertexts...
c1 = modexp(m, e, n1)
c2 = modexp(m, e, n2)
c3 = modexp(m, e, n3)
println("Three ciphertexts sent to three recipients...")
println("c1=", hex(c1))
println("c2=", hex(c2))
println("c3=", hex(c3))

# Check moduli are pairwise coprime...
println("Check moduli are pairwise coprime...")
g12 = gcd(n1,n2)
g23 = gcd(n2,n3)
g31 = gcd(n3,n1)
println("gcd(n1,n2)=", g12)
println("gcd(n2,n3)=", g23)
println("gcd(n3,n1)=", g31)
assert(g12==1 and g23==1 and g31==1, "Require moduli to be pairwise coprime")

println("Do calculations...")
# Compute N=n1*n2*n3
N = n1*n2*n3
# Compute N1 = N/n1, etc
N1 = N/n1
N2 = N/n2
N3 = N/n3
d1 = modinv(N1,n1)
d2 = modinv(N2,n2)
d3 = modinv(N3,n3)
# Compute x = c_1 N_1 d_1 + c_2 N_2 d_2 + c_3 N_3 d_3 (mod N)...
# (do in steps, all modulo N)
x1=modmul(modmul(c1,N1,N),d1,N)
x2=modmul(modmul(c2,N2,N),d2,N)
x3=modmul(modmul(c3,N3,N),d3,N)
x = (x1+x2+x3) mod N
println("x=", hex(x))
m1 = cbrt(x)
println("m1=cbrt(x)=", hex(m1))
# Do we have a match?
println("Match? (m == m1) is ", bool(m==m1))
if (m==m1) then println("SUCCESS") else println("FAILED!") fi