Jump to content

Playfair cipher: Difference between revisions

→‎{{header|J}}: tacit version of dedouble
(→‎{{header|J}}: handle strings with multiple doubles)
(→‎{{header|J}}: tacit version of dedouble)
Line 751:
 
restrict=: ] -. -.~
getidx=: 1 >:@+:@i.~ =/"1@(_2 ]\ ]) NB. index of digraph with repeated letter
dedouble=: verb define
splitDigraph=: ({. , 'X' , }.)~ getidx NB. split first digraphs with repeated letter
while. +./ msk=. =/"1 ] _2 ]\ y do.
dedouble=: dtb@:(>:@# {. splitDigraph)^:_ NB. split digraphs until until no change
y =. (1 2 p. {. I. msk) ({. , 'X' , }.) y
end.
y
)
 
choose 'Q'
892

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.