I think the easiest way is to make a CPU to do this or it will be too hard and/or long xD
(because you need loop , comparison , division , modulo , addition , substraction, memory to store the differents results and loop and all these functions are in a CPU)
I don't think using RSA encryption...