Challenges
Modular arithmetic: remainders
Cryptography
Easy
Modular remainders
Solves: 12
Modular arithmetic: remainders
Author: CyberSamSU
Points
12
Modular arithmetic is "clock arithmetic". If the time is 21:00 and another 5 hours pass, the result will not be 26, but 2: 26 mod 24 = 2. Almost all cryptography algorithms (RSA, Diffie-Hellman, ECC) are built on this arithmetic.
The most important rule: there is no need to wait until the end to take the remainder. (a + b) mod m = ((a mod m) + (b mod m)) mod m and (a · b) mod m = ((a mod m) · (b mod m)) mod m. Therefore, even when working with very large numbers, the numbers remain small.
The following values are given. Calculate (a · b + a + b) mod m.
m = 9635539
a = 707578474118614329902287107913392066437714860703441138943546
b = 614421098742138190161820615784721212621437577387068715412159
Answer: only a number — in decimal format, without spaces and additional characters (for example 1234).
Theory: learn the topic
To submit a flag, log in.