picoCTF2022 writeup Cryptography

警告
本文最后更新于 2023-01-29,文中内容可能已过时。

basic-mod1

给了一串数字

取模37 然后结果对应字典

exp:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
    ori = [387,248,131,272,373,221,161,110,91,359,390,50,225,184,223,137,225,327,42,179,220,365]
    disc1 = {1:'A',2:'B',3:'C',4:'D',5:'E',6:'F',7:'G',
        8:'H',9:'I',10:'J',11:'K',12:'L',13:'M',14:'N',
        15:'O',16:'P',17:'Q',18:'R',19:'S',20:'T',
        21:'U',22:'V',23:'W',24:'X',25:'Y',26:'Z',
        
        27:0,28:1,29:2,30:3,31:4,32:5,33:6,34:7,35:8,36:9,37:'_'}
    for i in range(len(ori)):
        a = (ori[i]%37) + 1
        res = disc1.get(int(a))
        print(res, end="")

picoCTF{R0UND_N_R0UND_B0D5F596}

basic-mod2

感觉答案没什么问题

脚本跑出来了

但是不对 就不写了

credstuff

给了两个txt 一一对应

找到cultiris在username的位置然后password去对应的地方找就行

凯撒遍历得到结果

picoCTF{C7r1F_54V35_71M3}

morse-code

一个音频 手撸出morse码即可

.--/..../....-/--.../..../....-/--.../..../----./-----/-../.--/..---/-----/..-/----./..../--.../

picoCTF{wh47h47h90dw20u9h7}

rail-fence

The rail fence cipher (also called a zigzag cipher) is a form of classical transposition cipher. It derives its name from the manner in which encryption is performed. 一种没见过的密码 不是栅栏密码 是换位密码的变种

wikipedia:https://en.wikipedia.org/wiki/Rail_fence_cipher

手撸

手撸

exp:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# This function receives cipher-text
# and key and returns the original
# text after decryption
def decryptRailFence(cipher, key):

	# create the matrix to cipher
	# plain text key = rows ,
	# length(text) = columns
	# filling the rail matrix to
	# distinguish filled spaces
	# from blank ones
	rail = [['\n' for i in range(len(cipher))]
				for j in range(key)]
	
	# to find the direction
	dir_down = None
	row, col = 0, 0
	
	# mark the places with '*'
	for i in range(len(cipher)):
		if row == 0:
			dir_down = True
		if row == key - 1:
			dir_down = False
		
		# place the marker
		rail[row][col] = '*'
		col += 1
		
		# find the next row
		# using direction flag
		if dir_down:
			row += 1
		else:
			row -= 1
			
	# now we can construct the
	# fill the rail matrix
	index = 0
	for i in range(key):
		for j in range(len(cipher)):
			if ((rail[i][j] == '*') and
			(index < len(cipher))):
				rail[i][j] = cipher[index]
				index += 1
		
	# now read the matrix in
	# zig-zag manner to construct
	# the resultant text
	result = []
	row, col = 0, 0
	for i in range(len(cipher)):
		
		# check the direction of flow
		if row == 0:
			dir_down = True
		if row == key-1:
			dir_down = False
			
		# place the marker
		if (rail[row][col] != '*'):
			result.append(rail[row][col])
			col += 1
			
		# find the next row using
		# direction flag
		if dir_down:
			row += 1
		else:
			row -= 1
	return("".join(result))

# Driver code
if __name__ == "__main__":

	
	# Now decryption of the
	# same cipher-text
	print(decryptRailFence("Ta _7N6D34hlg:W3D_H3C31N__198ef sHR053F38N43D80 i33___NF", 4))


# This code is contributed
# by Pratik Somwanshi

picoCTF{WH3R3_D035_7H3_F3NC3_8361N_4ND_3ND_318F0948}

substitution0

词频分析 用quipquip就可以

picoCTF{5UB5717U710N_3V0LU710N_F96A338E}

substitution1

同理 picoCTF{FR3QU3NCY_4774CK5_4R3_C001_3645BEC6}

substitution2

同理 picoCTF{N6R4M_4N41Y515_15_73D10U5_C823D467}

transposition-trial

heTfl g as iicpCTo{7F4NRP051N5_16_35P3X51N3_V8450214}1

每两位往前移一位

picoCTF{7R4N5P051N6_15_3XP3N51V3_58410214}

Vigenere

给了密钥 直接解就行

picoCTF{D0NT_US3_V1G3N3R3_C1PH3R_0df54reb}

0%