-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
88 lines (66 loc) · 2.82 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
WS/WORDS
========
This is my implementation of a cryptogram solver, It will only work with
simple-substitution ciphers (aka aristocrats).
CREDIT
======
Cryptograms and how to solve them was explained to me by Simon Jansen. This code is based
on that.
COMPATABILITY
=============
Pure standard python, no extra packages needed. Tested with Python 3.7. Other Python
versions > 3.4 may work.
WSBUILD
=======
First you need to build a catalog file from a word list. Sometimes a short word list of
common words is useful, sometimes a long list like /usr/share/dict/words works better.
Here's some sources of words that I have found:
- https://gist.github.com/deekayen/4148741
- https://github.com/dwyl/english-words
- https://github.com/sujithps/Dictionary
- /usr/share/dict/words
Build a catalog from your word list using the wsbuild command.
e.g. ./wsbuild.py words.txt catalog.db
words.txt is the word list and catalog.db is the name for the catalog to create.
WSSOLVE
=======
Now you can run the solver passing it the catalog you just created.
e.g. ./wssolve.py catalog.db
It will prompt you to enter the cryptogram. Punctuation can be entered and will be
ignored, except that contractions with ' are accepted as valid words.
Next it will prompt for any known letters. These can be entered in one of two possible
formats:
1. Letter assignments: e.g. M=J NBI=THE etc
2. Valid text matching letter for letter with the cryptogram above. Use spaces for the
letters that are not known.
Wssolve will try and solve the cryptogram and print out words that match.
Even if wssolve does not completely solve the cryptogram it may reduce the possibilities
down to where the solution is easy to spot by the semantics and grammar.
EXAMPLE
$ ./wssolve.py words.db
Enter the cryptogram: AXSBZ OYXM EXGGZEE CO FKWP OYX KWS PY BNQZ XI NR YMSZM PY BZP NP
Enter any known letters: W=A
Matching 38 possible words at go 3
Matching 38 possible words at go 4
Filtered 0 with words in go 0
axsbz oyxm exggzee co fkwp oyx kws py bnqz xi nr ymszm py bzp np
Cipher axsbzoymegcfkwpnqir->[bfjn]udgeyorsc[bmn][fkptw][hl]a[nt]i[bv][kmnpv][fnqt]
_udge your success _y __a_ you _ad _o gi_e u_ i_ order _o ge_ i_
budge your success by flan you had no gibe uk if order no gen in
fudge my flat lad to give um in to get it
judge ny khan un iq
nudge plan up it
than uv
what
BUGS/TO DO
==========
Automatically try different catalogs
Drop words and backtrack when matching or filtering gives no solution
Run multiple attempts starting on different words
Option to brute force cipher
More tests
COPYRIGHT
=========
David Moore 2021.
Licensed under the GPL. See LICENSE.
Have fun.