Data update
This commit is contained in:
parent
ed705008a8
commit
0df55f9f24
2196 changed files with 32999 additions and 3075 deletions
28
Task/Substitution-cipher/EasyLang/substitution-cipher.easy
Normal file
28
Task/Substitution-cipher/EasyLang/substitution-cipher.easy
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
alpha$[] = strchars "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
|
||||
key$[] = strchars "VsciBjedgrzyHalvXZKtUPumGfIwJxqOCFRApnDhQWobLkESYMTN"
|
||||
#
|
||||
proc subst in$ . out$ a$[] b$[] .
|
||||
out$ = ""
|
||||
for c$ in strchars in$
|
||||
for i to len a$[]
|
||||
if a$[i] = c$
|
||||
out$ &= b$[i]
|
||||
break 1
|
||||
.
|
||||
.
|
||||
if i > len a$[]
|
||||
out$ &= c$
|
||||
.
|
||||
.
|
||||
.
|
||||
func$ enc s$ .
|
||||
subst s$ r$ alpha$[] key$[]
|
||||
return r$
|
||||
.
|
||||
func$ dec s$ .
|
||||
subst s$ r$ key$[] alpha$[]
|
||||
return r$
|
||||
.
|
||||
c$ = enc "Hello world"
|
||||
print c$
|
||||
print dec c$
|
||||
Loading…
Add table
Add a link
Reference in a new issue