Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
18
Task/Caesar-cipher/Julia/caesar-cipher.julia
Normal file
18
Task/Caesar-cipher/Julia/caesar-cipher.julia
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function rot(s::String, key::Integer)
|
||||
map(s) do c
|
||||
if 'a' <= c <= 'z'
|
||||
char( mod(c - 'a' + key, 26) + 'a')
|
||||
elseif 'A' <= c <= 'Z'
|
||||
char( mod(c - 'A' + key, 26) + 'A')
|
||||
else
|
||||
c
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
key = 3
|
||||
txt = "The five boxing wizards jump quickly"
|
||||
|
||||
println("Original: ", txt);
|
||||
println("Encrypted: ", rot(txt, key))
|
||||
println("Decrypted: ", rot(rot(txt, key), 26 - key))
|
||||
Loading…
Add table
Add a link
Reference in a new issue