Bacon cipher: Difference between revisions
Content added Content deleted
(Added Quackery.) |
(→Raku: .. use bound sub-array instead of addressing list of 1-char lists .[0] hack; and minor changes) |
||
Line 2,310: | Line 2,310: | ||
sub bacon ($s, $msg) { |
sub bacon ($s, $msg) { |
||
my |
my @raw = $s.lc.comb; |
||
my |
my @txt := @raw[ (^@raw).grep({@raw[$_] (elem) @abc}) ]; |
||
for $msg.lc.comb Z |
for $msg.lc.comb Z @txt.batch(5) -> ($c-msg, @a) { |
||
for @a.kv -> $i, $c-str { |
for @a.kv -> $i, $c-str { |
||
my $x := @a[$i][ |
(my $x := @a[$i]) = $x.uc if %bacon{$c-msg}.comb[$i].Int.Bool; |
||
$x = $x.uc if %bacon{$c-msg}.comb[$i].Int.Bool; |
|||
} } |
} } |
||
@raw.join; |
|||
} |
} |
||