RSA: modular arithmetic
RSA is the most famous algorithm in public key cryptography. Its entire essence is in a single operation: c = me mod n. Here m is the message converted to a number, (n, e) is the public key that everyone can see, and c is the ciphertext.
mod is the remainder of division: 17 mod 5 = 2. When calculating a large power, it is impossible to calculate me completely first and then take the remainder — this number would consist of hundreds of thousands of digits. Python has a ready-made three-argument pow(m, e, n) function: it calculates the power step by step, taking the remainder by n at each step, and returns the answer instantly.
The following public key and message are given. Calculate the ciphertext:
n = 53430301190847186826778834741
e = 65537
m = 358116840277
Flag format: BAYROQ{RS4_shifrmatn_<c>} — where <c> is the number you calculated (in decimal, without spaces).