Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [topp]
- nomainwin
- UpperLeftX = 200
- UpperLeftY = 200
- WindowWidth = 375
- WindowHeight = 238
- BUTTON #win.go, "GO!", [start], UL, 215, 105, 49, 25
- BUTTON #win.end, "Close", [finished], UL, 255, 170, 50, 25
- RADIOBUTTON #win.eorde, "Encrypt", [encryptsub], wait, 30, 10, 75, 25
- RADIOBUTTON #win.eordd, "Decrypt", [decryptsub], wait, 110, 10, 75, 25
- STATICTEXT #win.words, "Word:", 46, 64, 30, 25
- TEXTBOX #win.word, 80, 59, 100, 25
- STATICTEXT #win.keys, "Key:", 196, 64, 25, 25
- TEXTBOX #win.key, 221, 59, 100, 25
- GROUPBOX #win.gi, "Input", 38, 41, 300, 55
- STATICTEXT #win.words, "Result:", 30, 142, 50, 25
- TEXTBOX #win.result, 80, 137, 245, 25
- open "Encrypt and Deccrypt" for window as #win
- wait
- [start]
- print #win.word, "!contents? word$"
- print #win.key, "!contents? key$"
- [lword]
- dim letter$(len(word$))
- for loop1 = 1 to len(word$)
- let letter$(loop1)=mid$(word$,loop1,1)
- next loop1
- [lkey]
- dim key$(len(key$))
- for loop1 = 1 to len(key$)
- let key$(loop1)=mid$(key$,loop1,1)
- next loop1
- [convertword]
- dim wnumber(len(word$))
- for loop1 = 1 to len(word$)
- let wnumber(loop1)=asc(letter$(loop1))
- next loop1
- [convertkey]
- dim knumber(len(key$))
- for loop1 = 1 to len(key$)
- let knumber(loop1)=asc(key$(loop1))
- next loop1
- [encryptdecrypt]
- if eord$="e" then goto [encrypt]
- if eord$="d" then goto [decrypt]
- [encrypt]
- dim encrypt(len(word$))
- let keyloop = 1
- for loop1 = 1 to len(word$) 'current error, add ascii, final far too high. need new system / back to old
- let encrypt(loop1)=wnumber(loop1)+knumber(keyloop)
- if encrypt(loop1)>122 and wnumber(loop1)<=122 and wnumber(loop1)>=97 then let encrypt(loop1) = encrypt(loop1) - 26
- if encrypt(loop1)>90 and wnumber(loop1)<=90 and wnumber(loop1)>=65 then let encrypt(loop1) = encrypt(loop1) - 26
- if keyloop = len(key$) then keyloop = 1 else keyloop = keyloop + 1
- next loop1
- goto [encryptenter]
- [decrypt]
- dim encrypt(len(word$))
- let keyloop = 1
- for loop1 = 1 to len(word$)
- let encrypt(loop1)=wnumber(loop1)-knumber(keyloop)
- if encrypt(loop1)<122 and wnumber(loop1)<=122 and wnumber(loop1)>=97 then let encrypt(loop1) = encrypt(loop1) + 26
- if encrypt(loop1)>90 and wnumber(loop1)<=90 and wnumber(loop1)>=65 then let encrypt(loop1) = encrypt(loop1) + 26
- if keyloop = len(key$) then keyloop = 1 else keyloop = keyloop + 1
- next loop1
- [encryptenter]
- if eord$="e" or eord$="d" then goto [skip]
- notice "ERROR; Select 'Encrypt' or 'Decrypt'"
- close #win
- goto [topp]
- [skip]
- [output]
- dim final$(len(word$))
- for loop1 = 1 to len(word$)
- let final$(loop1)=chr$(encrypt(loop1)+96)
- next loop1
- for loop1 = 1 to len(word$)
- let finalw$=finalw$;final$(loop1)
- next loop1
- print #win.result, finalw$
- let finalw$ = ""
- wait
- [end]
- close #win
- let finalw$ = ""
- goto [topp]
- [finished]
- close #win
- end
- [encryptsub]
- let eord$ = "e"
- wait
- [decryptsub]
- let eord$ = "d"
- wait
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement