Bifid cipher: Difference between revisions

Added Quackery.
(Added Quackery.)
Line 1,535:
Decrypted: THEINVASIONWILLSTARTONTHEFIRSTOFJANUARY
</pre>
 
=={{header|Quackery}}==
 
<code>transpose</code> is defined at [[Matrix transposition#Quackery]].
 
<syntaxhighlight lang="Quackery"> [ $ "" swap
witheach
[ upper
dup char I > if [ 1 - ]
dup char A char Z
within iff
[ char A - join ]
else drop ] ] is ->0..24 ( $ --> [ )
 
[ $ "" swap
witheach
[ char A +
dup char I > if 1+
join ] ] is ->A..Z ( [ --> $ )
 
[ [] 5 times
[ dip ->0..24 join ] ] is makesquare ( $ $ $ $ $ --> [ )
 
[ dup witheach
[ i^ unrot poke ] ] is makeindex ( [ --> [ )
 
[ dup temp put
makeindex temp put
->0..24
[] swap witheach
[ temp share swap peek
5 /mod join
nested join ]
temp release
transpose
unpack join
[] swap
dup size 2 / times
[ 2 split dip
[ nested join ] ]
drop
$ "" swap
witheach
[ unpack swap 5 * +
temp share swap peek
join ]
->A..Z
temp release ] is encrypt ( $ [ --> $ )
 
[ dup temp put
makeindex temp put
->0..24
[] swap witheach
[ temp share swap peek
5 /mod join join ]
temp release
dup size 2 / split
nested dip nested join
transpose
[] swap witheach
[ unpack swap 5 * +
temp share swap peek
join ]
->A..Z
temp release ] is decrypt ( $ [ --> $ )
 
[ $ "ABCDE"
$ "FGHIK"
$ "LMNOP"
$ "QRSTU"
$ "VWXYZ"
makesquare ] constant is tasksquare ( --> [ )
 
[ $ "BGWKZ"
$ "QPNDS"
$ "IOAXE"
$ "FCLUM"
$ "THYVR"
makesquare ] constant is wikisquare ( --> [ )
 
[ $ "QUACK"
$ "DEPTH"
$ "LYING"
$ "FORMS"
$ "BVWXZ"
makesquare ] constant is ducksquare ( --> [ )
 
 
say "Using tasksquare:" cr
$ "Attack at dawn." dup echo$ say " -> "
tasksquare encrypt dup echo$ say " -> "
tasksquare decrypt echo$
cr cr
say "Using wikisquare:" cr
$ "Flee at once." dup echo$ say " -> "
wikisquare encrypt dup echo$ say " -> "
wikisquare decrypt echo$
cr cr
say "Using ducksquare:" cr
$ "Soft quacks bring peace." dup echo$ say " -> "
ducksquare encrypt dup echo$ say " -> "
ducksquare decrypt echo$</syntaxhighlight>
 
{{out}}
 
<pre>Using tasksquare:
Attack at dawn. -> DQBDAXDQPDQH -> ATTACKATDAWN
 
Using wikisquare:
Flee at once. -> UAEOLWRINS -> FLEEATONCE
 
Using ducksquare:
Soft quacks bring peace. -> MOQQCXIYDUVCUNZANWPO -> SOFTQUACKSBRINGPEACE
Stack empty.
</pre>
 
=={{header|Raku}}==
Technically incorrect as the third part doesn't "Convert ... to upper case and ignore spaces".
1,462

edits