## Python solution script ```python= import string instr="rgnoDVD{O0NU_WQ3_G1G3O3T3_A1AH3S_2951c89f}" key="CYLAB" outstr="" offset_lower=ord('a') offset_upper=ord('A') lower=string.ascii_lowercase upper=string.ascii_uppercase dicts_l={} for k in key: key_loc=ord(k)-offset_upper dicts_l[k]={} for l in lower: cipher=chr((ord(l)-offset_lower+key_loc)%26+offset_lower) dicts_l[k][cipher]=l #dicts_l[key][cipher]=[plain] dicts_u = {} for k in key: key_loc = ord(k) - offset_upper dicts_u[k] = {} for u in upper: dicts_u[k][chr((ord(u) - offset_upper + key_loc) % 26 + offset_upper)] = u # dicts_u[key][cipher]=[plain] count=0 for c in instr: if c.isalpha(): if c.islower(): outstr+=dicts_l[key[count%len(key)]][c] elif c.isupper(): outstr+=dicts_u[key[count%len(key)]][c] count+=1 else: outstr+=c print(outstr) ``` =>`picoCTF{D0NT_US3_V1G3N3R3_C1PH3R_2951a89h}` Note that we have to use an indepedent `count` (increase only after processing a letter) to decode the cipher. If we use `i` from `enumerate`, the output is going to be weird, like this: `picoCTF{O0LW_WP3_V1F3Q3T3_C1AG3U_2951r89d}` ## Easier solution https://www.dcode.fr/vigenere-cipher ![](https://hackmd.io/_uploads/BJh7OVy2h.png) ## REFs - https://i.ytimg.com/vi/SkJcmCaHqS0/maxresdefault.jpg - Chart at the bottom of https://www.dcode.fr/vigenere-cipher