Write a Playfair encryption program
J I*, 536 431 417 380 263 218 203 197 186 167

p=:4 :0
a=.u:65+9-.~i.26
,_2(5|,:~@|.@(=/)+$$,A.~5*1-0{=/)&amp;.(5 5#:(~.n x,a)&amp;i.)\(,'X'#~2|#)(({.,'X',}.)~1+2*1{&amp;I._2{.\2=/\]) ::]^:_(n=:a(e.~#])'JI'charsub toupper)y
)


(with extensive suggestions from @algorithmshark)

example use:

   'Stack Overflow' p 'The cat crept into the crypt, crapped, and crept out again.'
SIRACARDFMVUICVSMORDZNAKECMZMFBCYNRDFMSVTVKBTMMY


splits input correctly:

   d=:(({.,'X',}.)~1+2*1{&amp;I._2{.\2=/\]) ::]
   d^:_ 'MASSACHUSETTS'
MASXSACHUSETTS




*replace every J with an I, right?