How to reduce multiple sets of possible character mappings?

Viewed 38

I am running a slide attack on a cipher to determine the cipher's key. I want to know if there is an existing mathematical/programmatic-based representation I could use within this attack. Below is a list of mapping relationships compiled by comparing various outputs and their respective inputs. It reads as follows, where '->' is used to represent a mapping from the lhs to the rhs:

If b->d... then z->i AND q->f.

Likewise, if z->i AND q->f... then b->d.

Alphabet:    'abcdefghijklmnopqrstuvwxyz_'
Example key: 'uwmsqbhkc_pgvtilnyfexjzarod'    (i.e. a shuffled alphabet)

   c1 c2  c3 c4
===============
a:  t, g | o, t
b:  z, q | x, q
c:  w, t | c, _
d:  i, h | i, f
e:  w, y | t, e
f:  u, e | e, d
g:  w, _ | y, m
h:  n, m | z, d
i:  i, j | h, f
j:  l, h | r, g
k:  w, b | t, v
l:  r, c | e, b
m:  l, u | z, e
n:  r, i | x, y
o:  g, s | e, a
p:  t, f | z, w
q:  u, r | z, r
r:  s, a | p, o
s:  t, _ | c, k
t:  n, t | y, c
u:  a, o | e, h
v:  y, l | g, x
w:  x, z | o, n
x:  z, n | u, i
y:  k, z | f, u
z:  t, x | a, o
_:  o, s | g, k

Additionally, the character frequencies of c1 and c2 MUST match the character frequencies of c3 and c4, respectively. In pseudo code, len(c1[freq1]) == len(c3[freq1]) and len(c2[freq2]) == len(c4[freq2]). Based on this, I have generated the following frequency "table" (a dictionary[freq: set(chars)] per column) where you can visually confirm this behavior:

c1: {4: {w, t}, 2: {u, i, r, l, z, n}, 1: {a, s, k, x, o, g, y}}
c3: {4: {e, z}, 2: {c, x, t, o, g, y}, 1: {u, i, r, a, f, p, h}}

c2: {2: {_, s, z, t, h}, 1: {n, m, q, b, u, i, r, a, c, f, l, x, e, j, o, g, y}}
c4: {2: {d, f, k, e, o}, 1: {y, n, m, q, b, u, i, a, _, r, c, x, w, v, g, t, h}}

This frequency table is what gives me a start on cracking the cipher. In the case of sets with a single character, we automatically learn the associated character mapping. Otherwise, we need to cross reference to learn mappings. The two methods I used to accomplish this are set intersections and set differences. For example, note that both c1[4] and c2[2] contain the character t. If we take the intersection of their potential mappings (i.e. c3[4] and c4[2]), we are left with the set {e} and thus t->e. Finding mappings via set differences is similar, so I won't give an example. Mappings found here can often be used to derive additional mappings from the first table.

In terms of this program, I am trying to find the best way to reduce the set of possibilities using physically-derived pieces of information via the methods above. Is there an existing mathematical/programmatic-based representation of this process? What's the proper name of this process? Additionally, are there more methods for extracting information that I'm not seeing?

Thanks! -yuno

0 Answers
Related