Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
16
Task/Caesar-cipher/Icon/caesar-cipher.icon
Normal file
16
Task/Caesar-cipher/Icon/caesar-cipher.icon
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
procedure main()
|
||||
ctext := caesar(ptext := map("The quick brown fox jumped over the lazy dog"))
|
||||
dtext := caesar(ctext,,"decrypt")
|
||||
write("Plain text = ",image(ptext))
|
||||
write("Encphered text = ",image(ctext))
|
||||
write("Decphered text = ",image(dtext))
|
||||
end
|
||||
|
||||
procedure caesar(text,k,mode) #: mono-alphabetic shift cipher
|
||||
/k := 3
|
||||
k := (((k % *&lcase) + *&lcase) % *&lcase) + 1
|
||||
case mode of {
|
||||
&null|"e"|"encrypt": return map(text,&lcase,(&lcase||&lcase)[k+:*&lcase])
|
||||
"d"|"decrypt" : return map(text,(&lcase||&lcase)[k+:*&lcase],&lcase)
|
||||
}
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue