Playfair cipher: Difference between revisions

Content added Content deleted
m (J: discard temps)
m (J: fix clipped code)
Line 249: Line 249:


encrypt=:3 :0
encrypt=:3 :0
,alt{~ref i. 2{."1 -.&' '"1 ~."1 (_2]\ norm y),"1 'XQV'
,alt{~ref i. 2{."1 -.&' '"1 ~."1 (_2]\ norm y),"1 norm 'XQV'
)
)


decrypt=:3 :0
decrypt=:3 :0
,ref{~alt i. 2{."1 -.&' '"1 ~."1 (_2]\ norm y),"1 norm 'XQV'
,</lang>
)</lang>


We could obviously factor out a routine to clean the text and form pairs to use for both encrypt and decrypt, but it works well enough like it is.
We could obviously factor out a routine to clean the text and form pairs to use for both encrypt and decrypt, but it works well enough like it is.