Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("top")
- t = {2, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 43}
- g = 200
- c = 1
- p, q, d, n, e, m, a, d1, d2, d3, d4 = 0
- function generate()
- q = t[math.random(1, 13)]
- p = t[math.random(1, 13)]
- while p == q do
- p = t[math.random(1, 13)]
- end
- n = p*q
- end
- function e()
- e = t[math.random(2, 13)]
- while n%e == 0 do
- e = t[math.random(2, 13)]
- end
- end
- function check()
- m = (4^e)%n
- d = 3
- for i = 1, g do
- c = (m^d)%n
- if c == 4 then
- g = i
- else
- d = d + 2
- end
- end
- end
- function send()
- generate()
- e()
- check()
- rednet.send(route, n)
- rednet.send(route, e)
- end
- function decrypt()
- d1 = (e1^d)%n
- d2 = (e2^d)%n
- d3 = (e3^d)%n
- d4 = (e4^d)%n
- end
- route, a, dis = rednet.receive()
- if a == 5 then
- send()
- route, account, dis = rednet.receive()
- route, e1, dis = rednet.receive()
- route, e2, dis = rednet.receive()
- route, e3, dis = rednet.receive()
- route, e4, dis = rednet.receive()
- decrypt()
- print(d1 .. d2 .. d3 .. d4)
- end
Advertisement
Add Comment
Please, Sign In to add comment