Thank you, Marshall. Your encoding is Playfair-like in that it encodes
triples,
not individual letters. Moreover it appears to obviate a need to "preprocess"
so that all message triples have three distinct letters. Very nice!
(];arr&encode) _3 ]\ message
+---+---+
|all|eai|
| is|uyy|
| di|sxu|
|sco|tbi|
|ver|tof|
|ed |col|
|fle|dkz|
|e |irr|
+---+---+
On 2/26/2011 8:38 PM, Marshall Lochbaum wrote:
> I can't think of anything as geometrically intuitive as the Playfair cypher.
> But a probable option is something like
>
> arr=.3 3 3$' ',~(97+i.26){a.
> message=.'all is discovered flee'
> encode=.([ {~ [:<"1@:(|:"2) $@[ #: ,@[ i. ])
>
> arr&encode _3 ]\ message
> eai
> uyy
> sxu
> tbi
> tof
> col
> dkz
> irr
> arr&encode^:2 ] _3 ]\ message
> all
> is
> di
> sco
> ver
> ed
> fle
> e
>
> Where each triplet is indexed to the cube, and then axes of the indices are
> transposed. Presumably this would be rather hard to crack without knowing
> the cube, but some of the indices don't change, so it might not be
> impossible.
>
> Marshall
>
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Kip Murray
> Sent: Saturday, February 26, 2011 5:58 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Playfair cipher
>
> Below is a three-dimensional picture of the character array
>
> pas
> wor
> dbc
>
> efg
> hij
> klm
>
> nqt
> uvx
> yz_
>
>
> 0
> \
> \
> \
> n------q------t
> |\ \ \
> | e------f------g
> u |\ \ \
> |\| p------a------s------------1
> | h | | |
> y |\| | |
> \| w------o------r
> k | | |
> \| | |
> d------b------c
> |
> |
> |
> |
> 2
>
> Does the picture help you formulate a 3-d analogue of the Playfair cipher
> for encoding "All is discovered flee" from the triples alx isd isc ove red
> fle ex_ ? Those triples again are
>
> alx
> isd
> isc
> ove
> red
> fle
> ex_
>
> On 2/19/2011 6:40 AM, Kip Murray wrote:
>> The Playfair cipher http://en.wikipedia.org/wiki/Playfair_cipher is
>> based on a 5 by 5 character array that treats i and j as equivalent:
>>
>> paswo
>> rdbce
>> fghik
>> lmnqt
>> uvxyz
>>
>> To encode "All is discovered flee" you replace pairs of letters al li
>> sd is co ve re df le ex with pairs diagonally opposite, one to the
>> right, or one below (wrapping) from the table, getting
>>
>> pm qf ab hw ew zd dr rg tr bz
>>
>> Your mission, should you decide to accept it, is to write j code for
>> enciphering and deciphering, given the five by five table. That's the
>> easy part. The hard part is to design and implement an analogous
>> cipher that uses the 3 by 3 by 3 character array below to replace
>> triples of letters alx _is _di sco ver ed_ fle ex_
>>
>> pas
>> wor
>> dbc
>>
>> efg
>> hij
>> klm
>>
>> nqt
>> uvx
>> yz_
>>
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm