Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
21
Task/Caesar-cipher/BaCon/caesar-cipher.bacon
Normal file
21
Task/Caesar-cipher/BaCon/caesar-cipher.bacon
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
CONST lc$ = "abcdefghijklmnopqrstuvwxyz"
|
||||
CONST uc$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
|
||||
CONST txt$ = "The quick brown fox jumps over the lazy dog."
|
||||
|
||||
FUNCTION Ceasar$(t$, k)
|
||||
|
||||
lk$ = MID$(lc$ & lc$, k+1, 26)
|
||||
uk$ = MID$(uc$ & uc$, k+1, 26)
|
||||
|
||||
RETURN REPLACE$(t$, lc$ & uc$, lk$ & uk$, 2)
|
||||
|
||||
END FUNCTION
|
||||
|
||||
tokey = RANDOM(25)+1
|
||||
PRINT "Encrypting text with key: ", tokey
|
||||
|
||||
en$ = Ceasar$(txt$, tokey)
|
||||
|
||||
PRINT "Encrypted: ", en$
|
||||
PRINT "Decrypted: ", Ceasar$(en$, 26-tokey)
|
||||
Loading…
Add table
Add a link
Reference in a new issue