\[ \begin{aligned} a \equiv b \pmod{n} &\Leftrightarrow \exists k \in \mathbb{Z}: a - b = kn \\ a \bmod{n} &= \text{the remainder when dividing $a$ by $n$} \\ a \bmod{n} = b &\Leftrightarrow a \equiv b \pmod{n} \ \land \ 0 \le b \le n-1 \\ a \equiv b \pmod{n} &\Leftrightarrow a \bmod{n} = b \bmod{n} \end{aligned} \]
Evaluate \(2020 \bmod{13}\) and \((-2020) \bmod{13}\).
2020 / 13 = 155
- 13
72
- 65
70
- 65
5
Solve \(x + 4 \equiv 2 \pmod{7}\) and \(3x - 4 \equiv 4 \pmod{7}\).
\[ \begin{aligned} x + 4 &\equiv 2 \pmod{7} \\ \exists k \in \mathbb{Z}: x + 4 - 2 &= 7k \\ \exists k \in \mathbb{Z}: x - (-2) &= 7k \\ x &\equiv -2 \pmod{7} \end{aligned} \]
\[ \begin{aligned} 3x - 4 &\equiv 4 \pmod{7} \\ 3x &\equiv 8 \pmod{7} \\ 3x &\equiv 1 \pmod{7} \\ \exists k \in \mathbb{Z}: 3x - 1 &= 7k \\ \exists k \in \mathbb{Z}: 3x &= 7k + 1 & k = 2 + 3t &\quad (k \equiv 2 \pmod{3}) \\ \exists t \in \mathbb{Z}: 3x &= 7(2 + 3t) + 1 \\ \exists t \in \mathbb{Z}: 3x &= 15 + 21t \\ \exists t \in \mathbb{Z}: x &= 5 + 7t \\ \exists t \in \mathbb{Z}: x - 5 &= 7t \\ x &\equiv 5 \pmod{7} \end{aligned} \]
\(3 \bot 7\) … \(3\) and \(7\) are coprime (\(\gcd(3, 7) = 1\))
List all the invertible elements in \(\mathbb{Z}_{26}\) and determine their inverses.
\[ \begin{aligned} 1^{-1} &\equiv 1 \pmod{26} & 25^{-1} &\equiv 25 \pmod{26} \\ 3^{-1} &\equiv 9 \pmod{26} & 23^{-1} &\equiv 17 \pmod{26} \\ 9^{-1} &\equiv 3 \pmod{26} & 17^{-1} &\equiv 23 \pmod{26} \\ 5^{-1} &\equiv 21 \pmod{26} & 21^{-1} &\equiv 5 \pmod{26} \\ 7^{-1} &\equiv 15 \pmod{26} & 19^{-1} &\equiv 11 \pmod{26} \\ 15^{-1} &\equiv 7 \pmod{26} & 11^{-1} &\equiv 19 \pmod{26} \end{aligned} \]
Prove that \(a \bmod{n} = b \bmod{n}\) if and only if \(a \equiv b \pmod{n}\).
Cryptosystem: \((\mathcal{P}, \mathcal{C}, \mathcal{K}, \mathcal{E}, \mathcal{D})\)
Caesar cipher:
Substitution cipher:
If an encryption function \(E_k\) is identical to the decryption function \(D_k\), then the key \(k\) is said to be an involutory key. Find all involutory keys for the Caesar cipher over \(\mathbb{Z}_{26}\).
\[ \begin{aligned} k &\equiv -k \pmod{26} \\ 2k &\equiv 0 \pmod{26} \\ k &\equiv 0 \pmod{13} \\ k &\in \{0, 13\} \end{aligned} \]
An affine cipher has \(E_k(x) = 5x+1 \bmod{26}\) as its encryption function. What is its decryption function?
Affine cipher:
Suppose that \(k = (a, b)\) is a key for the affine cipher over \(\mathbb{Z}_n\). Prove that \(k\) is involutory if and only if \(a^{-1} \bmod{n} = a\) and \(b(a+1) \equiv 0 \pmod{n}\).
Determine all involutory keys for the affine cipher over \(\mathbb{Z}_{26}\).
Is it possible that an affine cipher over \(\mathbb{Z}_{26}\) encrypts H to N and I to R?
Decrypt the following ciphertext, which has been obtained from a substitution cipher, with word division preserved. Help yourself with this website.
YI QCLJMXNCTJEL, T QTFPTC QYJEFC YP XIF XW MEF PYBJUFPM TIO BXPM
DYOFUL ZIXDI FIQCLJMYXI MFQEIYGAFP. YM YP T MLJF XW PASPMYMAMYXI
QYJEFC YI DEYQE FTQE UFMMFC YI MEF JUTYIMFKM YP CFJUTQFO SL
T UFMMFC PXBF WYKFO IABSFC XW JXPYMYXIP OXDI MEF TUJETSFM.
or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing