-1

In a cryptography challenge from PicoCTF called no padding no problem that I unfortunately wasn't able to solve, and had to use a writeup, one thing that threw me in this writeup and some experimentation unpadded RSA, is that given $D(c) = c^d \bmod n$, $D(c) = D(c \bmod n)$, why is this the case, why does one number raised to the power d mod n, end up being the same as the same number mod n then multiplied by d then mod again it just doesn't make sense, I think it has something to do with d being carefully chosen. Here's the writeup https://github.com/Dvd848/CTFs/blob/master/2021_picoCTF/No_Padding_No_Problem.md

Arturo Magidin
  • 417,286
john
  • 1
  • 1
    The remainder of dividing $c^d$ by $n$ is the same as the remainder of dividing $(c+kn)^d$ for any integer $k$; use the binomial theorem to expand and note that all terms except for the first are divisible by $n$, so you get the same remainder. However, the correct equation for the remainder would be $c^d\bmod n = ((c\bmod n)^d)\bmod n$. – Arturo Magidin Apr 26 '24 at 15:54

1 Answers1

-1

Modulo operation is compatible with the product, that is to say $$a\cdot b \bmod n= (a \bmod n)\cdot (b \bmod n)\bmod n$$ which then by induction implies that $$a^k \bmod n =(a\bmod n)^k \bmod n$$

Arturo Magidin
  • 417,286
b00n heT
  • 17,044
  • 1
  • 39
  • 52
  • 1
    \mod produces the same spacing as the parenthetical mod operator, but with parentheses omitted. The binary mod operator, whic you are using, is typeset with \bmod (for "binary mod", just like \pmod stands for "parenthetical mod") – Arturo Magidin Apr 26 '24 at 16:08
  • Good to know, thank you @ArturoMagidin ! (I indeed knew about \pmod and \mod, but not \bmod) – b00n heT Apr 26 '24 at 16:13
  • Please strive not to post more (dupe) answers to dupes of FAQs. This is enforced site policy, see here. It's best for site health to delete this answer (which also minimizes community time wasted on dupe processing.) – Bill Dubuque Apr 26 '24 at 16:22