Tell HN: ChatGPT can crack substitution cyphers
Me:
> A friend sent me this poem. But he used a substitution cypher on it and sent me this:
> Gdl ilzwh wrevitvw rm z bvoold dllw,
> Zmw hliib R xlfow mlg gizevo ylgs
> Zmw yv lmv gizevovi, olmt R hgllw
> Zmw ollpvw wldm lmv zh uzi zh R xlfow
> Gl dsviv rg yvmg rm gsv fmwvitildgs;
>
> Gsvm gllp gsv lgsvi, zh qfhg zh uzri,
> Zmw szermt kviszkh gsv yvggvi xozrn,
> Yvxzfhv rg dzh tizhhb zmw dzmgvw dvzi;
> Gslfts zh uli gszg gsv kzhhrmt gsviv
> Szw dlim gsvn ivzoob zylfg gsv hznv,
>
> Zmw ylgs gszg nlimrmt vjfzoob ozb
> Rm ovzevh ml hgvk szw gilwwvm yozxp.
> Ls, R pvkg gsv urihg uli zmlgsvi wzb!
> Bvg pmldrmt sld dzb ovzwh lm gl dzb,
> R wlfygvw ru R hslfow vevi xlnv yzxp.
>
> R hszoo yv gvoormt gsrh drgs z hrts
> Hlnvdsviv ztvh zmw ztvh svmxv:
> Gdl ilzwh wrevitvw rm z dllw, zmw R—
> R gllp gsv lmv ovhh gizevovw yb,
> Zmw gszg szh nzwv zoo gsv wruuvivmxv.
>
>Can you guess what he said?
ChatGPT:
> Certainly! Your friend has used a substitution cipher to encode the poem. A substitution cipher is a type of code that replaces each letter in the original text with a different letter or symbol. To decode the message, you need to replace each encoded letter with its original letter.
>
> Here's the decoded message:
>
> The woods are lovely dark and deep,
> But I have promises to keep,
> And miles to go before I sleep
> And miles to go before I sleep.
>
> This is a famous poem called "Stopping by Woods on a Snowy Evening" by Robert Frost.
6 comments
[ 3.6 ms ] story [ 20.3 ms ] threadIt started off with some random mapping. I didn’t bother changing it.
I tried 4 times with your exact prompt, and 1 time it simply said it was a substitution cipher & gave general advice on solving it, and 3 times it confabulated a poem (2 of which didn't follow the stanza line count at all). However, it is interesting that ChatGPT doesn't insist on its usual mode-collapse rhyming-quatrains and the poems are more varied than it usually generates when asked for a poem, so this might be a useful way to control output:
/sigh.
I'm almost as surprised as you are that it occasionally guesses Frost and so got it 'right'. There are a lot of famous poems, and I'm a little baffled that your friend would happen to try a poem that it would successfully guess on the first few tries. Either there's some deeper connection between Frost & substitution ciphers than I know of (maybe a tutorial somewhere?), or people are engaged in a lot of ChatGPT interactions such that even extremely improbable guesses like this will still occasionally succeed.