RosettaCodeData/Task/ADFGVX-cipher/Uiua/adfgvx-cipher.uiua
2024-07-13 15:19:22 -07:00

11 lines
574 B
Text

A ← ↯∞_2⊞⊟."ADFGVX"
P ← ⊏⍏[⍥⚂]⧻."ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
K ← "PACKHORSE"
Sw ← ⊜□≠" ".
Polybius ← setinv(/⊂⊡≡(⊚⌕):⊙:¤P A|⊏:P≡(⊢⊚⌕)⊙¤∩≡□↯∞_2:A)
SortByK ← setinv(⊏⍏⟜(⍉⬚" "↯⊟∞⧻)K|▽≠" "./⊂⍉⊏⍏⍏K)
Str ← setinv(/$"_ _"Sw/⊂≡(⊂:" ")|≡(⊢°□◇⬚" "↯⊟∞)/↥≡◇⧻.Sw)
Pt ← "ATTACKAT1200AM"
&p $"Key = _\nPolybius:\n_\nPlaintext = _"K↯⊟.√⧻.P Pt
&p$"Crypttext = _". Str SortByK Polybius Pt
&p$"Plaintext = _" °Polybius °SortByK °Str