Caesar cipher: Difference between revisions

Content added Content deleted
(→‎{{header|Ada}}: Fix the example, which was totally broken)
Line 4,296: Line 4,296:
Using the built-in rotate() function on a number over a range, a number outside of the range will pass through unaltered.
Using the built-in rotate() function on a number over a range, a number outside of the range will pass through unaltered.


<syntaxhighlight lang="langur">val .rot = f(.s, .key) {
<syntaxhighlight lang="langur">val .rot = fn(.s, .key) {
cp2s map(f(.c) rotate(rotate(.c, .key, 'a'..'z'), .key, 'A'..'Z'), s2cp .s)
cp2s map(fn(.c) rotate(rotate(.c, .key, 'a'..'z'), .key, 'A'..'Z'), s2cp .s)
}
}


Line 4,311: Line 4,311:
encrypted: X nrfzh yoltk clu grjmba lsbo pljbqefkd.
encrypted: X nrfzh yoltk clu grjmba lsbo pljbqefkd.
decrypted: A quick brown fox jumped over something.</pre>
decrypted: A quick brown fox jumped over something.</pre>

=={{header|Liberty BASIC}}==
=={{header|Liberty BASIC}}==
<syntaxhighlight lang="lb">key = 7
<syntaxhighlight lang="lb">key = 7