Cracking simple XOR cipher with simulated annealing, part II

Previously.

I've been playing NetHack and digging into its internals. In the end of the /usr/lib/games/nethack/nhdat file I've found such strings:

Ujaq0rc}(dicp(inw${xnwhl0ocim0xmqz0emc(Cqw`{0um$`qwg$i0bmkd0qgp&
...
Ujaq0rc}(dicp(inw${xnwhl0ogrmb!qhmuq"jmqs"mffhqmj|d"va~f"szqhvl{>
Ujaq0rc}(dicp(inw${xnwhl0ogrmb!vvq0um$du`ta(dig$leoeag~!um|x!c$jqf"kn0fgi{>
Ujaq0rc}(dicp(inw${xnwhl0sgigfd"}ges"ez}np$jugmvm0rkp|yoe$g~!c$|xsmjm>
...
Vg$`qwg$fuv"siir"kn0egpmsukjo0upaisigvq>/,[WO^][WO^][WO^][W
Vgp(dnuadc!oecu!evmqu"smqqmj{1^][WO^][WO^][WO^][WO^][WO^][W
Zakg{hgY(Gicp(q!rm|i-"}ge!aef~nv$zu`f$ad ][WO^][WO^][WO^][W

My gut says, this is a simple encryption, maybe XOR-ing, maybe 5-byte key (you see repeating pattern of 5-character length: "[WO^]").

I'll try simulated annealing to find XOR key, again:

state/key:
00000000: 01 02 04 08 10                                    .....
decrypted:
00000000: 59 6F 75 20 61 72 65 20  74 68 65 20 6F 6E 65 20  You are the one
00000010: 6D 69 6C 6C 69 6F 6E 74  68 20 76 69 73 69 74 6F  millionth visito
00000020: 72 20 74 6F 20 74 68 69  73 20 70 6C 61 63 65 21  r to this place!
00000030: 20 20 50 6C 65 61 73 65  20 77 61 69 74 20 32 30    Please wait 20
00000040: 30 20 74 75 72 6E 73 20  66 6F 72 20 79 6F 75 72  0 turns for your
00000050: 20 77 61 6E 64 20 6F 66  20 77 69 73 68 69 6E 67   wand of wishing
00000060: 2E 0E

Correct key found. As we supposed, this is English text. For other languages, other statistical features are to be used instead.

Of course, brute-force is not feasible.

Also, a short fancy video.

All the files, including last version of my decrypting utility.

(the post first published at 20260622.)


List of my other blog posts. Subscribe to my news feed,
If you noticed a typo/bug/error or have any suggestions, do not hesitate to drop me a note: my emails. Or use my zulip for feedback. Thanks in advance!
Also, among my services is writing examples-rich manuals, references and help files. If you like my work and want something similar for your (commercial) product: contact me.
If you enjoy my work, you can support it on patreon.
Some time ago (before 24-Mar-2025) there was Disqus JS script for comments. I dropped it --- it was so motley, distracting, animated, with too much ads. I never liked it. Also, comments din't appeared correctly (Disqus was buggy). Also, my blog is too chamberlike --- not many people write comments here. So I decided to switch to the model I once had at least in 2020 --- send me your comments by email (don't forget to include URL to this blog post) and I will copy&paste it here manually.
Let's party like it's ~1993-1996, in this ultimate, radical and uncompromisingly primitive pre-web1.0-style blog and website. This website is best viewed under lynx/links/elinks/w3m.