Skip to main content
The National Cipher Challenge

Reply To: Extracurricular Challenges

#98653
upsidedown
Participant

Additional hint for #98158 (this decodes the “prefix code” part, but does not solve the homophonic substitution):

As in #98652, the following (Hint 5) is enciphered using the 6B cipher.

uialqj = "60KP ZJ91 ... 9188 N5G"
# Wif'k sapul tsi oapsidleix uftz exd tsi ogndiomttzq juyw ax dtkuls,
# lrp eavi fzae e ewt.
nmbzec = ''.naan(n jaj c tr oapsid af n.mevirmf() gr n.meslalm())
kebyqfcpw = ewt(''.usuf(c tj o.asomsat() ppew ' ' fzv o an nmbzec).wbdie())

hqx id_eytiryams(ssygpsszws):
    # Lwemmp exd hzqahhzrqk aci afe zv foo omsat dicmeygqk
    adwqjt lpx(0 < dey(l) <= 2 rgr s mz zoxsbzoyie)
    # Zoxsbzoyie srp eytiryams tj fzeci mje 10 dmzylp-huyie laeoalafed
    # (fquafwq oe yiqv 26 sjqngld)
    mr dey(pukt(qmxlec(pmeboe t: dey(l) == 1, tgmzttgnpw))) == 10:
        dwtfvz Lrfi
    # Tgmzttgnpw mje lqnagfsgk iq xtwrp ijasew egmp xig spu tgmzttgnp
    # jaj wsmoz tsi rardx ewq tw uf tsi tgmzttgnp wql.
    rpxgjn lrk(snj(L rgr S mz zoxsbzoyie af wiz(Z) == 2 ayh T[0] == z) fzv t an ssygpsszws tj xwn(s) == 1)

hqx sevuh_pcirax(dic, zoxsbzoyie):
    xoc l uf hzqahhzrqk:
        iq wqi[:lpr(t)] == z:
            rpxgjn dic[dey(l):]
    dwtfvz keb

hqx fwefley(rqktph): dwtfvz [t fzv m an yieleo jaj b tr m]

veq mpwnemrq_hzqahhzrqk(spugwnnie, zoxsbzoyie):
    # Jenydkigi nssp gmked:
    mr as_lqnagfsgk(hzqahhzrqk): rpxgjn []

    # Wif'k rptqstphxq rpqane lrk zoxsbzoyie oe vrao fcsy lhp wfsre
    # sr slw xtw dtkul spugwnnie
    hrpz_ewqfizued = []
    atalp tdwv_dicmeygqk != spugwnnie:
        hrpz_ewqfizued = wqiuprows.nsbq()
        spugwnnie = (ktcmb_hrpjup(spu, tgmzttgnpw) rgr dic an dicmeygqk)
        spugwnnie = kee(judtpv(xsmmhm keb: pqf(spu) > 0, ewqfizued))

    # Gtwcv atwtsid oe sehw dpgaveo exd spugwnnie
    af wiz(kebyqfcpw) == 0: dwtfvz [zoxsbzoyie]

    # Gk, ysi lhp wql oq wqiuprows zrxq czrfsiyw ewqfizued xtst misan
    # hmfz a ssygpsszw wp lmne ysf qee pqsryx.

    eanrpq_virmf = kee(wqi fzv ewq tr ewqfizued mr dey(wqi) == 1)
    iq pqf(strsde_omsat) >= 1:
        # Lrk kebyqfcp xtst nszlatre gnwc afe omsat xyel bp e tgmzttgnp.
        vqlucr uveyxuxy_ssygpsszws(dicmeygqk, hzqahhzrqk | strsde_omsat)

    # Tj fzeci mjey'x mfy dmzylp huyie wq
Report a problem