## 一: 申論題55 分
1. 繪圖說明資安技術、資安服務、資安攻擊的關係
```mermaid
graph TD
A[Cybersecurity Technology] -->|Protects| B[Cybersecurity Services]
B -->|Targets of| C[Cybersecurity Attacks]
C -->|Mitigated by| A
```
2. 何為 Kerckhotf Principle, 請說明之:
密碼系統之安全性需僅依賴其秘密金鑰,而非其密碼演算法之隱藏
3. Rail Fence 加密法長度為3・明文為『TAIWANCANHELP』、密文為何?
- the rails
```
T A N P
A W N A H L
I C E
```
- the cipher
```
TANP AWNAHL ICE
```
4. 在凱撒加密法中,金鑰長度為10 ,加密明文CSIE後,密文為何?
凱撒加密法是通過將字母表按照一定的數量進行偏移來進行加密。金鑰長度為10意味著每個字母都會偏移10個位置。因此加密"CSIE"後,密文為"MODN"。
5. 在 AES 加密器中, 若圖二 S-BOX 的 輸 入 為 00001111 、 11000111 與 10011110, 輸出分別為何 (以二進位表示)?
:::success

:::
6. 2DES 為何不夠安全,請說明之
2DES不夠安全的原因是它容易受到所謂的中間人攻擊(Meet-in-the-middle attack),這種攻擊利用了2DES加密過程中的某些弱點,從而降低了破解的難度。
7. 何謂無條件安全、計算安全,請說明之
無條件安全指的是即便攻擊者擁有無限的計算資源,也無法破解加密,如一次性密碼本(One-time pad)。計算安全是指破解加密所需的計算資源超過攻擊者能力或所需時間遠遠超出有用的時間範圍。
8. 繪圖說明四種常見的攻擊類型,並以主動、被動攻擊分類
- DDoS Attack 分散式阻斷
- Malware 惡意軟體
- Sniffing 竊聽
- Phishing 網路釣魚
```mermaid
flowchart TD
A[Attacks] -->|Active| B[Active Attacks]
A -->|Passive| C[Passive Attacks]
B --> D[DDoS Attack]
B --> E[Malware]
C --> F[Sniffing]
C --> G[Phishing]
classDef active fill:#ff7f7f,stroke:#333,stroke-width:2px;
classDef passive fill:#7f7fff,stroke:#333,stroke-width:2px;
class B active;
class C passive;
```
9. 何謂崩塌效應,請說明之。
崩塌效應是指在密碼學中,輸入信息的微小變化(如一個位的變動)將導致輸出(密文)產生極大的不同,以此來確保密文的隨機性和不可預測性。
- [ ] 10. 在playfair cipher中,由字母建立的5*5對應表如圖一,請問明文『technology』加密後的密文為何?

11. 利用poly-alphabetic cipher,金鑰為SECRET,加密明文『security』,密文為何?
:::success
1. **Prepare the Key**:
- The key "SECRET" is aligned with the plaintext "security".
- Since "security" is 8 characters long and "SECRET" is only 6 characters long, we repeat the key until it matches the length of the plaintext.
- The key becomes "SECRETS" to match the 8 characters of "security".
```
Plaintext: security
Key: SECRETS
```
2. **Align with the Alphabet**:
- Each letter in the plaintext and the key is associated with a number that represents its position in the alphabet. A=0, B=1, ..., Z=25.
```
Plaintext: security -> 18 4 2 20 17 8 19 24
Key: SECRETS -> 18 4 2 17 4 19 18 18
```
3. **Encrypt Each Letter**:
- For each letter in the plaintext, add the number value of the corresponding key letter.
- If the sum is greater than 25 (the length of the alphabet), subtract 26 to wrap around.
For example, for the first letter:
- The plaintext letter "s" is the 18th letter of the alphabet.
- The key letter "S" is also the 18th letter of the alphabet.
- Adding these gives us 36, which is more than 25, so we subtract 26 to wrap around, giving us 10, which corresponds to the letter "K".
- Repeat this process for each letter in the plaintext:
```
s (18) + S (18) = 36 % 26 = 10 -> K
e (4) + E (4) = 8 % 26 = 8 -> I
c (2) + C (2) = 4 % 26 = 4 -> E
u (20) + R (17) = 37 % 26 = 11 -> L
r (17) + E (4) = 21 % 26 = 21 -> V
i (8) + T (19) = 27 % 26 = 1 -> B
t (19) + S (18) = 37 % 26 = 11 -> L
y (24) + S (18) = 42 % 26 = 16 -> C
```
4. **Result**:
- The final encrypted message (ciphertext) is constructed by combining the encrypted letters:
```
Plaintext: security
Key: SECRETS
Ciphertext: KIELVBLC
```
:::
12. 在AES中,利用ShiftRow 函數加密轉換圖三的値,可得到?

The first row is not shifted.
The second row is shifted one byte to the left.
The third row is shifted two bytes to the left.
The fourth row is shifted three bytes to the left.
13. 比較對稱式金鑰加密模式ECB和CBC的差異性
對稱式金鑰加密的ECB(電子代碼本)模式和CBC(密碼塊鏈)模式的主要差異在於加密過程中資料塊之間是否有關聯。ECB模式各資料塊獨立加密,而CBC模式中每個資料塊會與前一塊的密文進行XOR運算後再加密。
- [ ] 14. 集合 S={a, b,c},加法+乘法*運算定義如圖四,請問 (S;+)是交換群? (S;+*)是環?
:::success

:::
15. 說明破密者依收集的資訊多寡, 所進行的五種破密方式

## 二:計算題45分
1. 某物不知其數,三三數之剩2,五五數之剩1,七七數之剩5,此物最小可能為?若此物大約2000,此物可能為?(4分)
2. 在暴力攻擊法中,若金鑰長度為32位元,可能的金鑰數量有多少?若有一台電腦每秒鐘可以嘗試$2^{20}$把金鑰,請問攻擊者平均需花多少時間可以破解出金鑰?
- 對於一個32位元的金鑰,可能的組合數為 $2^{32}$ 種。這是因為每個位元有2種可能的值(0或1),所以總的可能性是 $2^{32}$。
- 如果有一台電腦每秒可以嘗試 $2^{20}$ 把金鑰,要找到正確的金鑰,我們將可能的金鑰總數除以每秒可以嘗試的次數,然後再除以2(因為平均而言,你可能在嘗試一半的金鑰數量時找到正確的金鑰)。
- 所以平均破解時間為 $\frac{2^{32}}{2^{20}} * \frac{1}{2}=2^{11}=2048$ 秒
3. 明文長度為 128MIB(MegaByte),若利用 AES128 系統加密文件,則請問需加密幾次?若利用 RSA1024 系統加密文件,則請問需加密幾次?
* ==AES128每次可以加密128位(即16字節==。因此,要加密128 MiB($128 \times 1024 \times 1024$ 字節)的數據,你需要將總字節數除以16來獲得加密操作的總次數。
* 對於RSA1024,無論明文的大小,每次加密都會處理1024位,所以理論上只需要一次加密操作。
6. $GF(2^8)$下, 不可約多項式為 $m(x)=x^8+x^4+x^3+x+1$,計算
- (1)$(x^5 + x^3 + 1) + (x^7 + x^4 + x^3 + x^2 + x)=?$
- (2)$(x^5 + x^3 + 1) * (x^7 + x^4 + x^3 + x^2 + x)=?$
:::success
There was an error in my initial approach. I attempted to use the `trunc` method on a `Mul` object, which is not valid. I need to properly construct the polynomials using `Poly` and then perform the operations within the finite field. Let's correct this and perform the calculations again.
For the given operations in \( GF(2^8) \) with the irreducible polynomial \( m(x) = x^8 + x^4 + x^3 + x + 1 \):
1. The addition $(x^5 + x^3 + 1) + (x^7 + x^4 + x^3 + x^2 + x)$ yields:
$$x^7 + x^5 + x^4 + x^2 + x + 1$$
Addition in a finite field is simply the XOR of the coefficients for each power of \( x \).
2. The multiplication $(x^5 + x^3 + 1) * (x^7 + x^4 + x^3 + x^2 + x)$, followed by reduction modulo the irreducible polynomial, yields:
$$x^6 + x^2$$
Multiplication in a finite field is done by multiplying the polynomials normally, then reducing the result modulo the irreducible polynomial to ensure the result stays within the field.
:::
7. 計算
- (1)$\phi(47)$
- (2)$\phi(155)$
- (3)$\phi(255)$
- (4)$\phi(64)$
- (5)$\phi(675)$
9. 判斷是否為質數?
- (1)457
- (2)757
- (3)1157
11. calculate
- (1) $5^{1111} \mod 22=?$
- (2) $3^{15} * 3^{16} \mod 17=?$
- (3) $7^{121} \mod 55=?$
12. 計算
- (1) $5^{-1} \mod 22 = ?$
- (2) $313^{-1} \mod 619 = ?$
- (3) $1123^{-1} \mod 521 = ?$
## 筆記
### 對稱式密碼系統
#### 對稱式金鑰密碼系統加密模式

### 數論
#### 擴展歐幾里德
:::info


:::
#### 歐拉函數


#### 歐拉定理

#### 中國剩餘定理
