Bacon cipher: Difference between revisions

Added Quackery.
m (Updated description and link for Fōrmulæ solution)
(Added Quackery.)
Line 2,077:
DECRYPTED =
rosetta code bacon cipher example secret phrase to encode in the capitalisation of peter pan</pre>
 
=={{header|Quackery}}==
 
<lang Quackery> [ dup upper swap lower != ] is ischar ( c --> b )
 
[ char a char z 1+ clamp
char a -
[ table
$ "AAAAA" $ "AAAAB" $ "AAABA" ( abc )
$ "AAABB" $ "AABAA" $ "AABAB" ( def )
$ "AABBA" $ "AABBB" $ "ABAAA" ( ghi )
$ "ABAAB" $ "ABABA" $ "ABABB" ( jkl )
$ "ABBAA" $ "ABBAB" $ "ABBBA" ( mno )
$ "ABBBB" $ "BAAAA" $ "BAAAB" ( pqr )
$ "BAABA" $ "BAABB" $ "BABAA" ( stu )
$ "BABAB" $ "BABBA" $ "BABBB" ( vwx )
$ "BBAAA" $ "BBAAB" ( y z ) ] do ] is baconian ( c --> $ )
[ $ "abcdefghijklmnopqrstuvwxyz"
0 rot witheach
[ char A = swap 1 << + ]
0 25 clamp peek ] is debacon ( $ --> c )
 
[ [] swap
witheach
[ dup ischar iff
[ lower baconian join ]
else drop ] ] is ->bacon$ ( $ --> $ )
 
[ [] [] rot
dup size 5 / times
[ 5 split
dip [ nested join ] ]
drop
witheach [ debacon join ] ] is debacon$ ( $ --> $ )
 
[ [] unrot ->bacon$ swap
witheach
[ over size if
[ dup ischar if
[ swap behead
dip swap
char A = iff
lower else upper ] ]
swap dip join ] drop ] is baconise ( $ $ --> $ )
 
[ [] swap
witheach
[ dup ischar iff
[ char A char Z 1+ within iff
[ char A ] else [ char B ]
join ]
else drop ]
debacon$ ] is debaconise ( $ --> $ )
 
$ "If it looks like a duck, and quacks like a duck, "
$ "we have at least to consider the possibility that "
$ "we have a small aquatic bird of the family anatidae "
$ " on our hands. "
$ "(This is a quote from the noted author Douglas Adams)"
4 times join
$ "Dirk Gently's Holistic Detective Agency"
baconise
dup nest$ 60 wrap$ cr cr
debaconise echo$
</lang>
 
{{out}}
 
<pre>if iT LoOks lIke a DuCk, And qUAcks Like A DuCK, we HAvE aT
LEAst tO coNsidER ThE POssIbILiTy thAt wE hAve A SmAll
aquaTic biRD of The FamILy aNatidaE oN ouR HaNds. (tHiS iS a
qUote from thE NoteD autHOr DougLaS Adams)
 
dirkgentlysholisticdetectiveagency</pre>
 
=={{header|Racket}}==
1,462

edits