Substitution cipher: Difference between revisions
no edit summary
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
No edit summary |
||
Line 2,356:
Decoded: I'm working on modernizing Rosetta Code's infrastructure. Starting with communications. Please accept this time-limited open invite to RC's Slack.. --Michael Mol (talk) 20:59, 30 May 2020 (UTC)
</pre>
=={{header|Vlang}}==
{{trans|Kotlin}}
<syntaxhighlight lang="vlang">
const
(
key = "]kYV}(!7P\$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs\"v*N[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\\C1yxJ"
text = "The quick brown fox jumps over the lazy dog, who barks VERY loudly!"
)
fn main() {
encoded := encode(text)
println(encoded)
println(decode(encoded))
}
fn encode(str string) string {
mut chr_arr := []u8{}
for chr in str {
chr_arr << key[u8(chr - 32)]
}
return chr_arr.bytestr()
}
fn decode(str string) string {
mut chr_arr := []u8{}
for chr in str {
chr_arr << u8(key.index_u8(chr) + 32)
}
return chr_arr.bytestr()
}
</syntaxhighlight>
{{out}}
<pre>
2bu]E,KHm].Tdc|]4d\]),8M>]dQuT]<bu]U31C]Idf_]cbd].3Tm>]+ZzL]Ud,IUCk
The quick brown fox jumps over the lazy dog, who barks VERY loudly!
</pre>
=={{header|Wren}}==
{{trans|Kotlin}}
|