There is a classic substitution cipher technique that uses a 25-square ($5 \times 5$) grid which holds 25 of the 26 letters of the roman alphabet:
- + 1 2 3 4 5
- 1 A B C D E
- 2 F G H I J
- 3 K L M N O
- 4 P Q R S T
- 5 U V W X Y
It's effectively a short-hand technique for creating a substitution cipher by viewing it as a toroidal lattice, letting NORTH define the mapping {'A'$\to$'U', 'B'$\to$'V', ... 'Y'$\to$'T'}, etc. Effectively, north maps the coordinates (x,y) to ($NORTH_x(x),NORTH_y(y)$), for $x,y \in$ {1,2,3,4,5},
$NORTH_x(t)=t$, for $1 \le t \le 5$
$NORTH_y(t)=$ $t-1$ for $2\le t \le 5$,
$NORTH_y(t)=5$ for $t=1$.
Similar definitions exist for SOUTH, EAST, and WEST. The Identity direction or NULL direction stands for the identity function, $NULL(t)=t$.
A message can be encoded with a single direction, meaning only one substitution cipher is used for the entire message. A message can be encoded with multiple directions, meaning that each sequential letter is encoded by a different direction, rolling over when you get to the end of the cipher.
Napoleon used a variation of this, with two $5 \times 5$ grids, with a pass-phrase used for the second grid.
This may have nothing to do with what you're asking for. Your explanation thus far is not illumination illuminating enough for me to grasp what it is exactly that you are trying to do. Can you explain your ultimate end-goal? Is it to create an encrytion cipher? Is it to analyze an already existing encrypted message? Is it to analyze a particular encoding algorithm or technique?
What exactly is the underlying problem which you are attempting to solve?

