Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,23 @@
module SubstitutionCiphers
using Compat
const key = "]kYV}(!7P\$n5_0i R:?jOWtF/=-pe'AD&@r6%ZXs\"v*N[#wSl9zq2^+g;LoB`aGh{3.HIu4fbK)mU8|dMET><,Qc\\C1yxJ"
function encode(s::AbstractString)
buf = IOBuffer()
for c in s
print(buf, key[Int(c) - 31])
end
return String(take!(buf))
end
function decode(s::AbstractString)
buf = IOBuffer()
for c in s
print(buf, Char(findfirst(==(c), key) + 31))
end
return String(take!(buf))
end
end # module SubstitutionCiphers

View file

@ -0,0 +1,5 @@
let s = "The quick brown fox jumps over the lazy dog, who barks VERY loudly!"
enc = SubstitutionCiphers.encode(s)
dec = SubstitutionCiphers.decode(enc)
println("Original: ", s, "\n -> Encoded: ", enc, "\n -> Decoded: ", dec)
end