Substitution cipher: Difference between revisions

Content added Content deleted
(Added 11l)
Line 20: Line 20:
* [[wp:Substitution_cipher|Wikipedia: Substitution cipher]]
* [[wp:Substitution_cipher|Wikipedia: Substitution cipher]]
<br><br>
<br><br>

=={{header|11l}}==
{{trans|Kotlin}}

<lang 11l>V key = ‘]kYV}(!7P$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs"v*N[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\C1yxJ’

F encode(s)
V r = ‘’
L(c) s
r ‘’= :key[c.code - 32]
R r

F decode(s)
V r = ‘’
L(c) s
r ‘’= Char(code' :key.index(c) + 32)
R r

V s = ‘The quick brown fox jumps over the lazy dog, who barks VERY loudly!’
V enc = encode(s)
print(‘Encoded: ’enc)
print(‘Decoded: ’decode(enc))</lang>

{{out}}
<pre>
Encoded: 2bu]E,KHm].Tdc|]4d\]),8M>]dQuT]<bu]U31C]Idf_]cbd].3Tm>]+ZzL]Ud,IUCk
Decoded: The quick brown fox jumps over the lazy dog, who barks VERY loudly!
</pre>


=={{header|Ada}}==
=={{header|Ada}}==