---
# System prepended metadata

title: basic-mod1-100pt
tags: [picoCTF, 從零開始的 picoCTF, Cryptography, picoCTF2022]

---

# basic-mod1-100pt
[題目在這](https://play.picoctf.org/practice/challenge/253?originalEvent=70&page=1)
## 題意
![](https://i.imgur.com/UAzmDtZ.png)


## 解題思路

給的檔案長這樣

![](https://i.imgur.com/xxJXKiC.png)

寫個 python 去跑答案就出來了

```python=
text = []
result = ''

with open('message.txt','r') as f:
    s = f.readline().strip(' ')
    text = s.split(' ')

for i in range(len(text)):
    char = int(text[i])
    char %= 37
    if (char < 26):
        result += chr(char+65)
    elif (char == 36):
        result += '_'
    else:
        result += chr(char+22)

print(result)
```

## 困難之處

讀檔格式那邊用了一些時間

因為 basic-mod2 去看了一下別人怎麼寫得發現了更好的寫法，如下:
```python=
import string

key = string.ascii_uppercase + string.digits + "_"
text = []
result = ''
with open('message.txt','r') as f:
    s = f.readline().strip(' ')
    text = s.split(' ')

for i in range(len(text)):
    char = int(text[i]) % 37
    result += key[char]

print(result)
```

Date : 2023/04/12
###### tags: `picoCTF2022` [`從零開始的 picoCTF`](https://hackmd.io/-KQeDuzrQMOcFNhwU_5eKA?both=) `picoCTF` `Cryptography` 