Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TextWindow.WriteLine("Enter prime number p: ")
- p = TextWindow.ReadNumber()
- TextWindow.WriteLine("Enter prime number q: ")
- q = TextWindow.ReadNumber()
- n = p * q
- Øn = (p-1)*(q-1)
- TextWindow.WriteLine("n = " + n)
- TextWindow.WriteLine("Øn = " + Øn)
- TextWindow.WriteLine("Enter number relatively prime to Øn, e: ")
- e = TextWindow.ReadNumber()
- TextWindow.WriteLine("Enter number d, such that ed = 1 (mod(Øn)): ")
- d = TextWindow.ReadNumber()
- TextWindow.WriteLine("Break up message into blocks of 3")
- TextWindow.WriteLine("Block 1=?: ")
- pm1 = TextWindow.ReadNumber()
- TextWindow.WriteLine("Block 2=?: ")
- pm2 = TextWindow.ReadNumber()
- TextWindow.WriteLine("Block 3=?: ")
- pm3 = TextWindow.ReadNumber()
- TextWindow.WriteLine("Block 4=?: ")
- pm4 = TextWindow.ReadNumber()
- sm1 = Math.Remainder(Math.Power(pm1, e), n)
- sm2 = Math.Remainder(Math.Power(pm2, e), n)
- sm3 = Math.Remainder(Math.Power(pm3, e), n)
- sm4 = Math.Remainder(Math.Power(pm4, e), n)
- TextWindow.Write(sm1 )
- TextWindow.Write(sm2 )
- TextWindow.Write(sm3 )
- TextWindow.Write(sm4 )
Add Comment
Please, Sign In to add comment