# Encrypt and Decrypt

Jul 8th, 2012
2,330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. [topp]
2. nomainwin
3. UpperLeftX = 200
4. UpperLeftY = 200
5. WindowWidth = 375
6. WindowHeight = 238
7.
8.
9. BUTTON #win.go, "GO!", [start], UL, 215, 105, 49, 25
10. BUTTON #win.end, "Close", [finished], UL, 255, 170, 50, 25
11. RADIOBUTTON #win.eorde, "Encrypt", [encryptsub], wait, 30, 10, 75, 25
12. RADIOBUTTON #win.eordd, "Decrypt", [decryptsub], wait, 110, 10, 75, 25
13. STATICTEXT #win.words, "Word:", 46, 64, 30, 25
14. TEXTBOX #win.word, 80, 59, 100, 25
15. STATICTEXT #win.keys, "Key:", 196, 64, 25, 25
16. TEXTBOX #win.key, 221, 59, 100, 25
17. GROUPBOX #win.gi, "Input", 38, 41, 300, 55
18. STATICTEXT #win.words, "Result:", 30, 142, 50, 25
19. TEXTBOX #win.result, 80, 137, 245, 25
20. open "Encrypt and Deccrypt" for window as #win
21. wait
22.
23.
24.
25. [start]
26.
27. print #win.word, "!contents? word\$"
28. print #win.key, "!contents? key\$"
29.
30. [lword]
31. dim letter\$(len(word\$))
32. for loop1 = 1 to len(word\$)
33.     let letter\$(loop1)=mid\$(word\$,loop1,1)
34. next loop1
35.
36. [lkey]
37. dim key\$(len(key\$))
38. for loop1 = 1 to len(key\$)
39.     let key\$(loop1)=mid\$(key\$,loop1,1)
40. next loop1
41.
42. [convertword]
43. dim wnumber(len(word\$))
44. for loop1 = 1 to len(word\$)
45.     let wnumber(loop1)=asc(letter\$(loop1))
46. next loop1
47.
48. [convertkey]
49. dim knumber(len(key\$))
50. for loop1 = 1 to len(key\$)
51.     let knumber(loop1)=asc(key\$(loop1))
52. next loop1
53.
54. [encryptdecrypt]
55. if eord\$="e" then goto [encrypt]
56. if eord\$="d" then goto [decrypt]
57.
58. [encrypt]
59. dim encrypt(len(word\$))
60. let keyloop = 1
61. for loop1 = 1 to len(word\$)    'current error, add ascii, final far too high.  need new system / back to old
62.     let encrypt(loop1)=wnumber(loop1)+knumber(keyloop)
63.     if encrypt(loop1)>122 and wnumber(loop1)<=122 and wnumber(loop1)>=97 then let encrypt(loop1) = encrypt(loop1) - 26
64.     if encrypt(loop1)>90 and wnumber(loop1)<=90 and wnumber(loop1)>=65 then let encrypt(loop1) = encrypt(loop1) - 26
65.     if keyloop = len(key\$) then keyloop = 1 else keyloop = keyloop + 1
66. next loop1
67. goto [encryptenter]
68.
69. [decrypt]
70. dim encrypt(len(word\$))
71. let keyloop = 1
72. for loop1 = 1 to len(word\$)
73.     let encrypt(loop1)=wnumber(loop1)-knumber(keyloop)
74.     if encrypt(loop1)<122 and wnumber(loop1)<=122 and wnumber(loop1)>=97 then let encrypt(loop1) = encrypt(loop1) + 26
75.     if encrypt(loop1)>90 and wnumber(loop1)<=90 and wnumber(loop1)>=65 then let encrypt(loop1) = encrypt(loop1) + 26
76.     if keyloop = len(key\$) then keyloop = 1 else keyloop = keyloop + 1
77. next loop1
78.
79. [encryptenter]
80. if eord\$="e" or eord\$="d" then goto [skip]
81. notice "ERROR; Select 'Encrypt' or 'Decrypt'"
82. close #win
83. goto [topp]
84. [skip]
85.
86. [output]
87. dim final\$(len(word\$))
88. for loop1 = 1 to len(word\$)
89.     let final\$(loop1)=chr\$(encrypt(loop1)+96)
90. next loop1
91.
92. for loop1 = 1 to len(word\$)
93.    let finalw\$=finalw\$;final\$(loop1)
94. next loop1
95. print #win.result, finalw\$
96. let finalw\$ = ""
97. wait
98.
99. [end]
100. close #win
101. let finalw\$ = ""
102. goto [topp]
103.
104. [finished]
105. close #win
106. end
107.
108. [encryptsub]
109. let eord\$ = "e"
110. wait
111.
112. [decryptsub]
113. let eord\$ = "d"
114. wait
{"ft_lang_label":"__label__en","ft_lang_prob":0.5031088,"math_prob":0.99680454,"size":3090,"snap":"2023-40-2023-50","text_gpt3_token_len":1133,"char_repetition_ratio":0.19539857,"word_repetition_ratio":0.27125505,"special_character_ratio":0.41165048,"punctuation_ratio":0.16869566,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99735737,"pos_list":[0,1,2],"im_url_duplicate_count":[null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-27T17:29:05Z\",\"WARC-Record-ID\":\"<urn:uuid:5ef73064-180b-49af-87b9-b8a6448abb2f>\",\"Content-Length\":\"44352\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:12d62631-540f-4053-a4af-6a3ba842406b>\",\"WARC-Concurrent-To\":\"<urn:uuid:0be2e26c-35b0-459f-bab1-d1cb821162e7>\",\"WARC-IP-Address\":\"104.20.68.143\",\"WARC-Target-URI\":\"https://pastebin.com/Bitn6rTy\",\"WARC-Payload-Digest\":\"sha1:3PTKKR6LF7GC5P2I2IMMZAKKJS6A4TQT\",\"WARC-Block-Digest\":\"sha1:24PEIHSNLPKWWL7YGGUON2ON3BF4OTZH\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233510319.87_warc_CC-MAIN-20230927171156-20230927201156-00318.warc.gz\"}"}