Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
7
Task/Caesar-cipher/Zkl/caesar-cipher-1.zkl
Normal file
7
Task/Caesar-cipher/Zkl/caesar-cipher-1.zkl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
fcn caesarCodec(str,n,encode=True){
|
||||
var [const] letters=["a".."z"].chain(["A".."Z"]).pump(String); // static
|
||||
if(not encode) n=26 - n;
|
||||
m,sz := n + 26, 26 - n;
|
||||
ltrs:=String(letters[n,sz],letters[0,n],letters[m,sz],letters[26,n]);
|
||||
str.translate(letters,ltrs)
|
||||
}
|
||||
6
Task/Caesar-cipher/Zkl/caesar-cipher-2.zkl
Normal file
6
Task/Caesar-cipher/Zkl/caesar-cipher-2.zkl
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
text:="The five boxing wizards jump quickly";
|
||||
N:=3;
|
||||
code:=caesarCodec(text,N);
|
||||
println("text = ",text);
|
||||
println("encoded(%d) = %s".fmt(N,code));
|
||||
println("decoded = ",caesarCodec(code,N,False));
|
||||
Loading…
Add table
Add a link
Reference in a new issue