Contents
  1. 1. 前言
  2. 2. 正文
    1. 2.1. easy
    2. 2.2. keyboard
    3. 2.3. 异性相吸
    4. 2.4. Winner Winner Chicken Dinner

前言

密码学之旅

正文

easy

一个简单的base64解密

AO2jTU.png

keyboard

AORmfH.png

看看键盘,比划一下,发现是areuhack

异性相吸

TIPS:
1.xor //异或
2.hex2binary //十六进制转二进制
3.len(bin(miwen))==len(bin(mingwen)) //二进制密文长度等于二进制明文长度

这是所有的提示信息

脚本,

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
ming=[]
with open("ming.txt") as f1:
for i in f1.read():
ming.append(i)
print(ming)

mi=[]
with open("mi.txt") as f2:
for i in f2.read():
mi.append(i)
print(mi)

flag=''
for i in range(len(ming)):
flag+=chr(ord(ming[i])^ord(mi[i]))
print flag

Eg4AsS.png

Winner Winner Chicken Dinner

给了一个加密算法

1
2
3
4
5
6
7
8
9
10
11
#coding:utf-8
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_pkcs1_v1_5
import base64

flag=raw_input('flag:')
key=RSA.construct((1063045321283844468344531168992778520651192162100948533991539097447031440090068191835838938460807260866872379834796862916118785271062209281267667069640000501698142693389209275376843382863579650119977059768375028586326490055087394631528241983631462471709913758728591459476799115050977493979613545056736162868049L, 837165022918376318972691589160491375229372195625940137121740685432530132860541010174727630660292946071507342455170833392895060048564125597915757582027572284342507277083636059558106672685400173531425920294781499112027917632497954958437660357575400222692979844873372105801998210845285775146263117399191185379347L))
cipher = Cipher_pkcs1_v1_5.new(key)
cipher_text = base64.b64encode(cipher.encrypt(flag))
print cipher_text
#cipher_text = 'AGgt1h6dudnkeoCr7SFclkYYsYa65KZ8V29bbgbf+BDyjnyx5stCYjcyktat73aHs2EOaMgwGUwj3HwPTvT+T5LHIxM4uTnAgWOui4dnb7vF7QizN0ShY2O1h26CgLnf5I0vQWbY7WCC7kA/orNW7F5yxZiKRAawacS2M5ghP4/Q'

这考察了RSA的winner’s attack,

参考文章

Contents
  1. 1. 前言
  2. 2. 正文
    1. 2.1. easy
    2. 2.2. keyboard
    3. 2.3. 异性相吸
    4. 2.4. Winner Winner Chicken Dinner