Skip to content

Instantly share code, notes, and snippets.

@Luzifer
Last active September 14, 2020 19:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Luzifer/b2d1573ef2c142659e238ea751732742 to your computer and use it in GitHub Desktop.
Save Luzifer/b2d1573ef2c142659e238ea751732742 to your computer and use it in GitHub Desktop.
"The Beast Inside" - Solver for the cryptoanalysis book to be found in the new house

This is a quite simple try to solve the puzzle from the cryptoanalysis book from the "The Beast Inside" game.

# python solve.py
N	R	DKKLAJ	HOOPEN
A	Z	TUFSMJOH	STERLING
W	Z	HGXBO	KJAER
K	Y	ZQDUVMZM	NERIJANA
O	S	GQPHAOW	KUTLESA
L	P	NQPDE	RUTHI
S	X	EHXXMZZ	JMCCREE
J	T	FUFFUH	PEPPER
V	O	ZVVAFZOLLW	SOOTYSHEEP
C	O	QVIFQVWZZ	CHURCHILL
H	J	FCJBCLFCPX	HELDENHERZ
F	R	XSOBBSHHS	JEANNETTE
Q	P	QBSBCPMJT	PARABOLIS
N	Q	TLICMOBAXQLO	WOLFPREDATOR
E	C	VJGFKDDWM	THEDIBBUK
W	A	ZQJCAKJIWOPAN	DUNGEONMASTER
G	B	XHZRGFLGJSOFRNS	SCUMBAGBENJAMIN
N R DKKLAJ
A Z TUFSMJOH
W Z HGXBO
K Y ZQDUVMZM
O S GQPHAOW
L P NQPDE
S X EHXXMZZ
J T FUFFUH
V O ZVVAFZOLLW
C O QVIFQVWZZ
H J FCJBCLFCPX
F R XSOBBSHHS
Q P QBSBCPMJT
N Q TLICMOBAXQLO
E C VJGFKDDWM
W A ZQJCAKJIWOPAN
G B XHZRGFLGJSOFRNS
def solve(ch1, ch2, crypt):
rot = ord(ch1) - ord(ch2)
out = []
for chs in crypt:
nord = ord(chs) + rot
if nord > ord('Z'):
nord = nord - 26
elif nord < ord('A'):
nord = nord + 26
out.append(chr(nord))
print('{ch2}\t{ch1}\t{crypt}\t{solution}'.format(
ch1=ch1,
ch2=ch2,
crypt=crypt,
solution=''.join(out),
))
def main():
with open('input.txt') as f:
for line in f:
(ch2, ch1, crypt) = line.strip().split(' ')
solve(ch1, ch2, crypt)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment