# 一个有意思的解密

rozbo

## 第一关

### 密文

begin 777 portal.bin
M(R!796QC;VUE#0H-"B,C(\$ME>0T*#0I24T\$@4'5B;&EC(\$ME>3H@*\$XL(#7!T960@=VET:"!T:&4@*BI24T\$@4'5B;&EC(\$ME
M>2HJ+@T*#0I@8&`-"D-/3D-!5"A\$14-265!4*#\$Y-S,W,BDN=&]3=')I;F>= 1
b = (b*b) % m
return result

def primeTest(n):
q = n - 1
k = 0
while q % 2 == 0:
k += 1;
q /= 2
a = random.randint(2, n-2);
if fastExpMod(a, q, n) == 1:
return "inconclusive"
for j in range(0, k):
if fastExpMod(a, (2**j)*q, n) == n - 1:
return "inconclusive"
return "composite"

def findPrime(halfkeyLength):
while True:
n = random.randint(0, 1=//80*Y./YOI\$*@LU"J-Z@UFUWL/%]Q!_EKD0\[2%L*[SR45;._(;/'.L+0%WL5XR\$WL,4GXQ9G(:[@&;1Y'0Z"0*P940A,:9
M\$W&7+NJ+YL#DXZ9WD,MN=IKT1-(7(,%
MN[*!#TA?04GTUO7L#1+!+=,0``")\$
>@7M0Y!TN``&[`Y`\$``##!+%.L<1G^P(`````!%E:
`
end

### 分析

import magic
#读入
#获取类型
magic.from_buffer(data)
#lzma

79955ff7576a0f5a167b3ccb506bed3a d46b6f8c1ea3b812c2bba0edc0e63c85 | Roman Hitman
================================================================
H4sIAAAAAAACA1WPT0+DQBDF7/spRgTttbRsZRPZ1d1Fwg0OBYKEhWqMlwZBqjaF
z+7Win8ylzeT95u8F8Otj4UkjIrCcxCKYzCmA0KqAMvFYFMRYA6SwTVZ4RykvvmU
3GEu9GZTB7DWoXQJvdqi6gRJTKULPVkwai+XBKjvLTDforqAeTsObWMlnS1x0XPm
7XEYMO4k0a6fgcBU6N/g2GGUFj3jni2T6HDouiiH6N0c758eSxWlOXzxAwt+TF3n
edr0z5bOdSv4YITChYkMA3ac+TfPKDuJ71xABGTZlKuuFIxq87CBF1XqUapMs0wj
l5iTVQhtc2a1b80Rmrqs9+scmsGcvZ4nhkp/dfVH18c0n2XEkwVzAQAA

import base64
str='H4sIAAAAAAACA1WPT0+DQBDF7/spRgTttbRsZRPZ1d1Fwg0OBYKEhWqMlwZBqjaF\
z+7Win8ylzeT95u8F8Otj4UkjIrCcxCKYzCmA0KqAMvFYFMRYA6SwTVZ4RykvvmU\
3GEu9GZTB7DWoXQJvdqi6gRJTKULPVkwai+XBKjvLTDforqAeTsObWMlnS1x0XPm\
7XEYMO4k0a6fgcBU6N/g2GGUFj3jni2T6HDouiiH6N0c758eSxWlOXzxAwt+TF3n\
edr0z5bOdSv4YITChYkMA3ac+TfPKDuJ71xABGTZlKuuFIxq87CBF1XqUapMs0wj\
l5iTVQhtc2a1b80Rmrqs9+scmsGcvZ4nhkp/dfVH18c0n2XEkwVzAQAA'
base64.b64decode(str)

def caesar_decode(data, num=47):
res = ''
for x in data:
if x in (' ', '\n'):
tmp = x
elif 32 <= (ord(x) + num) <= 126:
tmp = chr(ord(x) + num)
else:
tmp = chr(ord(x) - num)
res += tmp

return res

### 明文

## Questions

2. The tenth Fibonacci number? Google 之
3. `CONCAT(Date.FromKeyword("GFW sensive day").Format("MMDD", "ISO-8601"), Date.Now.Format("DDmm", , "ISO-8601"))`

QQ Group:
* Group number is **CONCAT(D321 O1454 B10101110)**

### 算答案

def fib(n):
if n == 0:
return 0
if n <= 2:
return 1
return fib(n - 1) + fib(n - 2)

5.1k 声望
498 粉丝