Ooops
March 05, 2021, 06:20:16 AM

Author Topic: [bmx] encrytion text readerwriter by Mainsworthy [ 1+ years ago ]  (Read 530 times)

Offline BlitzBot

Title : encrytion text readerwriter
Author : Mainsworthy
Posted : 1+ years ago

Description : well this is the source code to my manual reader writer app, its not pretty, but it works for my purpose , change little things to do differrent encryption .

this only took me a day to do so you will probably find endless ways to improve it, I wrote it as an example to show how you can make your own PDF type Manuals that are encryted.


Code :
Code: BlitzMax
  1. 'reader Manual code below Writer code at the end of reader code
  2.  
  3. Graphics 1024,768,32,60
  4.  
  5. Global store[4081*20]
  6. Global page = 0
  7. Global psy = 0
  8. Global gfx = 20
  9. Global ok = 1
  10. Global sline = 0
  11.  
  12. Global ssave = LoadImage(".grafixack.PNG",flags=ALPHABITS  )
  13. Global lload = LoadImage(".grafixforward.PNG",flags=ALPHABITS  )
  14. Global pics = LoadAnimImage(".userstuffpics.PNG",350,695,0,gfx,flags=ALPHABITS  )
  15. savedit = ReadStream( ".userstuffencryptedtext.txt" )
  16.  
  17.  
  18. While Not KeyHit(KEY_ESCAPE)
  19. Cls
  20. DrawText "Use UP & DOWN Cursor keys or -", 670,715
  21. DrawText "Forward & Back for fast scroll", 670,729
  22. DrawText "Programed By Mark Ainsworth 210665", 670,745
  23.  
  24. If KeyHit(KEY_UP) Then sline = sline - 66
  25. If KeyHit(KEY_DOWN) Then sline = sline + 66
  26. If sline > (4080*20)-67 Then sline = 4079*20-66
  27.  
  28.  
  29. DrawImage( ssave ,909+48,705,frame=1 )
  30. DrawImage( lload ,909+48,736,frame=1 )
  31.  
  32. If MouseDown(1) And MouseX() > 957 And MouseX() < 957+45 And MouseY() > 705 And MouseY() < 735
  33. #qwbnms
  34. If MouseDown(1) Then Goto qwbnms
  35. page = page - 1
  36. If page < 0 Then page = 0
  37. ok = 1
  38. sline = 0
  39. EndIf
  40.  
  41. If MouseDown(1) And MouseX() > 957 And MouseX() < 957+45 And MouseY() > 736 And MouseY() < 765
  42. #dqwbnms
  43. If MouseDown(1) Then Goto dqwbnms
  44. page = page + 1
  45. If page > 19 Then page = 19
  46. ok = 1
  47. sline = 0
  48. EndIf
  49.  
  50. If ok = 1
  51. If Not savedit
  52. Goto nofile
  53. EndIf
  54.  
  55. bt = 0
  56. crypta = 0
  57. crypta2 = 3
  58. For j = 0 To (19*4080) + 4079
  59. If Not Eof(savedit)
  60. bt = ReadInt (savedit)
  61. crypta = crypta + 1
  62. If crypta = 16 Then crypta = 0
  63. store[j] = bt - crypta - crypta2
  64. EndIf
  65.  
  66. Next
  67. #nofile
  68. ok = 0
  69. EndIf
  70.  
  71.  
  72. disppage()
  73. DrawImage( pics,670 ,0,psy )
  74.  
  75.  
  76.  
  77.  
  78.  
  79. Flip
  80. Wend
  81. CloseStream savedit
  82.  
  83. End
  84.  
  85. Function disppage()
  86. psy = 0
  87. p = page * 4080
  88. p = p + sline
  89.  
  90. For v = 0 To 68
  91. For cnt = 0 To 66
  92. If cnt > 56 And store[p] = 84 Then store[p] = 100
  93.  
  94. If store[p] = 100 v = v + 1
  95. If store[p] = 100 cnt = 0
  96.  
  97. If store[p] = 79 Then psy = psy + 1
  98. 'set psy maximum png files 0=1 1=2 2=3 so on
  99. If psy > 19 Then psy = 19
  100.  
  101. If store[p] = 1  Then DrawText "a", cnt*10,v*10
  102. If store[p] = 2  Then DrawText "b", cnt*10,v*10
  103. If store[p] = 3  Then DrawText "c", cnt*10,v*10
  104. If store[p] = 4  Then DrawText "d", cnt*10,v*10
  105. If store[p] = 5  Then DrawText "e", cnt*10,v*10
  106. If store[p] = 6  Then DrawText "f", cnt*10,v*10
  107. If store[p] = 7  Then DrawText "g", cnt*10,v*10
  108. If store[p] = 8  Then DrawText "h", cnt*10,v*10
  109. If store[p] = 9  Then DrawText "i", cnt*10,v*10
  110. If store[p] = 10  Then DrawText "j", cnt*10,v*10
  111. If store[p] = 11  Then DrawText "k", cnt*10,v*10
  112. If store[p] = 12  Then DrawText "l", cnt*10,v*10
  113. If store[p] = 13  Then DrawText "m", cnt*10,v*10
  114. If store[p] = 14  Then DrawText "n", cnt*10,v*10
  115. If store[p] = 15  Then DrawText "o", cnt*10,v*10
  116. If store[p] = 16  Then DrawText "p", cnt*10,v*10
  117. If store[p] = 17  Then DrawText "q", cnt*10,v*10
  118. If store[p] = 18  Then DrawText "r", cnt*10,v*10
  119. If store[p] = 19  Then DrawText "s", cnt*10,v*10
  120. If store[p] = 20  Then DrawText "t", cnt*10,v*10
  121. If store[p] = 21  Then DrawText "u", cnt*10,v*10
  122. If store[p] = 22  Then DrawText "v", cnt*10,v*10
  123. If store[p] = 23  Then DrawText "w", cnt*10,v*10
  124. If store[p] = 24  Then DrawText "x", cnt*10,v*10
  125. If store[p] = 25  Then DrawText "y", cnt*10,v*10
  126. If store[p] = 26  Then DrawText "z", cnt*10,v*10
  127.  
  128. If store[p] = 27  Then DrawText "A", cnt*10,v*10
  129. If store[p] = 28  Then DrawText "B", cnt*10,v*10
  130. If store[p] = 29  Then DrawText "C", cnt*10,v*10
  131. If store[p] = 30  Then DrawText "D", cnt*10,v*10
  132. If store[p] = 31  Then DrawText "E", cnt*10,v*10
  133. If store[p] = 32  Then DrawText "F", cnt*10,v*10
  134. If store[p] = 33  Then DrawText "G", cnt*10,v*10
  135. If store[p] = 34  Then DrawText "H", cnt*10,v*10
  136. If store[p] = 35  Then DrawText "I", cnt*10,v*10
  137. If store[p] = 36  Then DrawText "J", cnt*10,v*10
  138. If store[p] = 37  Then DrawText "K", cnt*10,v*10
  139. If store[p] = 38  Then DrawText "L", cnt*10,v*10
  140. If store[p] = 39  Then DrawText "M", cnt*10,v*10
  141. If store[p] = 40  Then DrawText "N", cnt*10,v*10
  142. If store[p] = 41  Then DrawText "O", cnt*10,v*10
  143. If store[p] = 42  Then DrawText "P", cnt*10,v*10
  144. If store[p] = 43  Then DrawText "Q", cnt*10,v*10
  145. If store[p] = 44  Then DrawText "R", cnt*10,v*10
  146. If store[p] = 45  Then DrawText "S", cnt*10,v*10
  147. If store[p] = 46  Then DrawText "T", cnt*10,v*10
  148. If store[p] = 47  Then DrawText "U", cnt*10,v*10
  149. If store[p] = 48  Then DrawText "V", cnt*10,v*10
  150. If store[p] = 49  Then DrawText "W", cnt*10,v*10
  151. If store[p] = 50  Then DrawText "X", cnt*10,v*10
  152. If store[p] = 51  Then DrawText "Y", cnt*10,v*10
  153. If store[p] = 52  Then DrawText "Z", cnt*10,v*10
  154.  
  155. If store[p] = 53  Then DrawText "0", cnt*10,v*10
  156. If store[p] = 54  Then DrawText "1", cnt*10,v*10
  157. If store[p] = 55  Then DrawText "2", cnt*10,v*10
  158. If store[p] = 56  Then DrawText "3", cnt*10,v*10
  159. If store[p] = 57  Then DrawText "4", cnt*10,v*10
  160. If store[p] = 58  Then DrawText "5", cnt*10,v*10
  161. If store[p] = 59  Then DrawText "6", cnt*10,v*10
  162. If store[p] = 60  Then DrawText "7", cnt*10,v*10
  163. If store[p] = 61  Then DrawText "8", cnt*10,v*10
  164. If store[p] = 62  Then DrawText "9", cnt*10,v*10
  165. If store[p] = 63  Then DrawText "10", cnt*10,v*10
  166.  
  167. If store[p] = 64  Then DrawText "-", cnt*10,v*10
  168. If store[p] = 65  Then DrawText "=", cnt*10,v*10
  169. If store[p] = 66  Then DrawText "<", cnt*10,v*10
  170. If store[p] = 67  Then DrawText ">", cnt*10,v*10
  171. If store[p] = 68  Then DrawText ".", cnt*10,v*10
  172. If store[p] = 69  Then DrawText ",", cnt*10,v*10
  173. If store[p] = 70  Then DrawText "(", cnt*10,v*10
  174. If store[p] = 71  Then DrawText ")", cnt*10,v*10
  175. If store[p] = 72  Then DrawText "[", cnt*10,v*10
  176. If store[p] = 73  Then DrawText "]", cnt*10,v*10
  177. If store[p] = 74  Then DrawText "+", cnt*10,v*10
  178. If store[p] = 75  Then DrawText "&", cnt*10,v*10
  179. If store[p] = 76  Then DrawText "#", cnt*10,v*10
  180. If store[p] = 77  Then DrawText ";", cnt*10,v*10
  181. If store[p] = 78  Then DrawText ":", cnt*10,v*10
  182. If store[p] = 79  Then DrawText "@", cnt*10,v*10
  183. If store[p] = 80  Then DrawText "?", cnt*10,v*10
  184. If store[p] = 81  Then DrawText "_", cnt*10,v*10
  185. If store[p] = 82  Then DrawText "%", cnt*10,v*10
  186. If store[p] = 83  Then DrawText "!", cnt*10,v*10
  187. If store[p] = 84  Then DrawText " ", cnt*10,v*10
  188. 'If store[p] = 200 Then DrawText "
  189. ", cnt*10,v*10
  190. If store[p] = 0 Then DrawText " ", cnt*10,v*10
  191.  
  192. If v > 68
  193. cnt = 66
  194. v = 68
  195. EndIf
  196.  
  197. p = p + 1
  198. If p > (4080*20)-1 Then p = 4079*20
  199. 'If p > 4079 Then p = p - 1
  200.  
  201.  
  202.  
  203. Next
  204. Next
  205.  
  206. End Function
  207.  
  208.  
  209. 'writer Manual
  210. Graphics 1024,768,32,60
  211.  
  212. Global store[4081*20]
  213. Global btg = 0
  214. Global page = 0
  215. Global p = 0
  216. Global psy = 0
  217. Global gfx = 20
  218.  
  219. While Not KeyHit(KEY_ESCAPE)
  220. Cls
  221. DrawText "Programed By Mark Ainsworth 210665", 670,745
  222.  
  223. #dqwbnms
  224. savedit = ReadStream( ".userstuffunencryptedtext.txt" )
  225.  
  226. If Not savedit
  227. Goto nofile
  228. EndIf
  229.  
  230. bt = 0
  231. bt2 = 0
  232. crypta = 0
  233. crypta2 = 3
  234. For jh = 0 To 19
  235. For j = 0 To 4079
  236.  
  237. If Not Eof(savedit) Then bt2 = ReadByte (savedit)
  238. bt = bt2
  239. btg = 0
  240.  
  241. If bt = 97 Then btg = 1
  242. If bt = 98 Then btg = 2
  243. If bt = 99 Then btg = 3
  244. If bt = 100 Then btg = 4
  245. If bt = 101 Then btg = 5
  246. If bt = 102 Then btg = 6
  247. If bt = 103 Then btg = 7
  248. If bt = 104 Then btg = 8
  249. If bt = 105 Then btg = 9
  250. If bt = 106 Then btg = 10
  251. If bt = 107 Then btg = 11
  252. If bt = 108 Then btg = 12
  253. If bt = 109 Then btg = 13
  254. If bt = 110 Then btg = 14
  255. If bt = 111 Then btg = 15
  256. If bt = 112 Then btg = 16
  257. If bt = 113 Then btg = 17
  258. If bt = 114 Then btg = 18
  259. If bt = 115 Then btg = 19
  260. If bt = 116 Then btg = 20
  261. If bt = 117 Then btg = 21
  262. If bt = 118 Then btg = 22
  263. If bt = 119 Then btg = 23
  264. If bt = 120 Then btg = 24
  265. If bt = 121 Then btg = 25
  266. If bt = 122 Then btg = 26
  267.  
  268. If bt = 65 Then btg = 27
  269. If bt = 66 Then btg = 28
  270. If bt = 67 Then btg = 29
  271. If bt = 68 Then btg = 30
  272. If bt = 69 Then btg = 31
  273. If bt = 70 Then btg = 32
  274. If bt = 71 Then btg = 33
  275. If bt = 72 Then btg = 34
  276. If bt = 73 Then btg = 35
  277. If bt = 74 Then btg = 36
  278. If bt = 75 Then btg = 37
  279. If bt = 76 Then btg = 38
  280. If bt = 77 Then btg = 39
  281. If bt = 78 Then btg = 40
  282. If bt = 79 Then btg = 41
  283. If bt = 80 Then btg = 42
  284. If bt = 81 Then btg = 43
  285. If bt = 82 Then btg = 44
  286. If bt = 83 Then btg = 45
  287. If bt = 84 Then btg = 46
  288. If bt = 85 Then btg = 47
  289. If bt = 86 Then btg = 48
  290. If bt = 87 Then btg = 49
  291. If bt = 88 Then btg = 50
  292. If bt = 89 Then btg = 51
  293. If bt = 90 Then btg = 52
  294.  
  295. If bt = 48 Then btg = 53
  296. If bt = 49  Then btg = 54
  297. If bt = 50  Then btg = 55
  298. If bt = 51  Then btg = 56
  299. If bt = 52  Then btg = 57
  300. If bt = 53  Then btg = 58
  301. If bt = 54  Then btg = 59
  302. If bt = 55  Then btg = 60
  303. If bt = 56  Then btg = 61
  304. If bt = 57  Then btg = 62
  305. If bt = 58  Then btg = 63
  306.  
  307. If bt = 45  Then btg = 64
  308. If bt = 61  Then btg = 65
  309. If bt = 60  Then btg = 66
  310. If bt = 62  Then btg = 67
  311. If bt = 46  Then btg = 68
  312. If bt = 44  Then btg = 69
  313. If bt = 40  Then btg = 70
  314. If bt = 41  Then btg = 71
  315. If bt = 91  Then btg = 72
  316. If bt = 93  Then btg = 73
  317. If bt = 43  Then btg = 74
  318. If bt = 38  Then btg = 75
  319. If bt = 35  Then btg = 76
  320. If bt = 59  Then btg = 77
  321. If bt = 58  Then btg = 78
  322. If bt = 64  Then btg = 79
  323. If bt = 63  Then btg = 80
  324. If bt = 95  Then btg = 81
  325. If bt = 37  Then btg = 82
  326. If bt = 33 Then btg = 83
  327. If bt = 32 Then btg = 84
  328. If bt = 13 Then btg = 100
  329.  
  330. bt = btg
  331.  
  332. If bt > 0 And bt < 85 store[j+(jh*4080)] = bt
  333. If bt = 100 store[j+(jh*4080)] = bt
  334. Next
  335. Next
  336. CloseStream savedit
  337. #nofile
  338. #qwbnms
  339. savedit = WriteStream( ".userstuffencryptedtext.txt" )
  340.  
  341. If Not savedit
  342. Goto nofile2
  343. EndIf
  344.  
  345. bt = 0
  346. crypta = 0
  347. crypta2 = 3
  348. For kl = 0 To 19
  349. For j = 0 To 4079
  350. bt = store[j+(kl*4080)]
  351. crypta = crypta + 1
  352. If crypta = 16 Then crypta = 0
  353. bt = bt + crypta + crypta2
  354.  
  355. WriteInt (savedit, bt)
  356. Next
  357. Next
  358. FlushStream(savedit)
  359. CloseStream savedit
  360. #nofile2
  361.  
  362.  
  363.  
  364.  
  365. DrawText "Press Escape Manual has been created", 10,10
  366.  
  367.  
  368.  
  369. Flip
  370. Wend
  371.  
  372. Function disppage()
  373. p = page * 4080
  374.  
  375. For v = 0 To 68
  376. For cnt = 0 To 60
  377. If store[p] = 90 v = v + 1
  378. If store[p] = 90 cnt = 0
  379.  
  380.  
  381.  
  382. If store[p] = 1  Then DrawText "a", cnt*10,v*10
  383. If store[p] = 2  Then DrawText "b", cnt*10,v*10
  384. If store[p] = 3  Then DrawText "c", cnt*10,v*10
  385. If store[p] = 4  Then DrawText "d", cnt*10,v*10
  386. If store[p] = 5  Then DrawText "e", cnt*10,v*10
  387. If store[p] = 6  Then DrawText "f", cnt*10,v*10
  388. If store[p] = 7  Then DrawText "g", cnt*10,v*10
  389. If store[p] = 8  Then DrawText "h", cnt*10,v*10
  390. If store[p] = 9  Then DrawText "i", cnt*10,v*10
  391. If store[p] = 10  Then DrawText "j", cnt*10,v*10
  392. If store[p] = 11  Then DrawText "k", cnt*10,v*10
  393. If store[p] = 12  Then DrawText "l", cnt*10,v*10
  394. If store[p] = 13  Then DrawText "m", cnt*10,v*10
  395. If store[p] = 14  Then DrawText "n", cnt*10,v*10
  396. If store[p] = 15  Then DrawText "o", cnt*10,v*10
  397. If store[p] = 16  Then DrawText "p", cnt*10,v*10
  398. If store[p] = 17  Then DrawText "q", cnt*10,v*10
  399. If store[p] = 18  Then DrawText "r", cnt*10,v*10
  400. If store[p] = 19  Then DrawText "s", cnt*10,v*10
  401. If store[p] = 20  Then DrawText "t", cnt*10,v*10
  402. If store[p] = 21  Then DrawText "u", cnt*10,v*10
  403. If store[p] = 22  Then DrawText "v", cnt*10,v*10
  404. If store[p] = 23  Then DrawText "w", cnt*10,v*10
  405. If store[p] = 24  Then DrawText "x", cnt*10,v*10
  406. If store[p] = 25  Then DrawText "y", cnt*10,v*10
  407. If store[p] = 26  Then DrawText "z", cnt*10,v*10
  408.  
  409. If store[p] = 27  Then DrawText "A", cnt*10,v*10
  410. If store[p] = 28  Then DrawText "B", cnt*10,v*10
  411. If store[p] = 29  Then DrawText "C", cnt*10,v*10
  412. If store[p] = 30  Then DrawText "D", cnt*10,v*10
  413. If store[p] = 31  Then DrawText "E", cnt*10,v*10
  414. If store[p] = 32  Then DrawText "F", cnt*10,v*10
  415. If store[p] = 33  Then DrawText "G", cnt*10,v*10
  416. If store[p] = 34  Then DrawText "H", cnt*10,v*10
  417. If store[p] = 35  Then DrawText "I", cnt*10,v*10
  418. If store[p] = 36  Then DrawText "J", cnt*10,v*10
  419. If store[p] = 37  Then DrawText "K", cnt*10,v*10
  420. If store[p] = 38  Then DrawText "L", cnt*10,v*10
  421. If store[p] = 39  Then DrawText "M", cnt*10,v*10
  422. If store[p] = 40  Then DrawText "N", cnt*10,v*10
  423. If store[p] = 41  Then DrawText "O", cnt*10,v*10
  424. If store[p] = 42  Then DrawText "P", cnt*10,v*10
  425. If store[p] = 43  Then DrawText "Q", cnt*10,v*10
  426. If store[p] = 44  Then DrawText "R", cnt*10,v*10
  427. If store[p] = 45  Then DrawText "S", cnt*10,v*10
  428. If store[p] = 46  Then DrawText "T", cnt*10,v*10
  429. If store[p] = 47  Then DrawText "U", cnt*10,v*10
  430. If store[p] = 48  Then DrawText "V", cnt*10,v*10
  431. If store[p] = 49  Then DrawText "W", cnt*10,v*10
  432. If store[p] = 50  Then DrawText "X", cnt*10,v*10
  433. If store[p] = 51  Then DrawText "Y", cnt*10,v*10
  434. If store[p] = 52  Then DrawText "Z", cnt*10,v*10
  435.  
  436. If store[p] = 53  Then DrawText "0", cnt*10,v*10
  437. If store[p] = 54  Then DrawText "1", cnt*10,v*10
  438. If store[p] = 55  Then DrawText "2", cnt*10,v*10
  439. If store[p] = 56  Then DrawText "3", cnt*10,v*10
  440. If store[p] = 57  Then DrawText "4", cnt*10,v*10
  441. If store[p] = 58  Then DrawText "5", cnt*10,v*10
  442. If store[p] = 59  Then DrawText "6", cnt*10,v*10
  443. If store[p] = 60  Then DrawText "7", cnt*10,v*10
  444. If store[p] = 61  Then DrawText "8", cnt*10,v*10
  445. If store[p] = 62  Then DrawText "9", cnt*10,v*10
  446. If store[p] = 63  Then DrawText "10", cnt*10,v*10
  447.  
  448. If store[p] = 64  Then DrawText "-", cnt*10,v*10
  449. If store[p] = 65  Then DrawText "=", cnt*10,v*10
  450. If store[p] = 66  Then DrawText "<", cnt*10,v*10
  451. If store[p] = 67  Then DrawText ">", cnt*10,v*10
  452. If store[p] = 68  Then DrawText ".", cnt*10,v*10
  453. If store[p] = 69  Then DrawText ",", cnt*10,v*10
  454. If store[p] = 70  Then DrawText "(", cnt*10,v*10
  455. If store[p] = 71  Then DrawText ")", cnt*10,v*10
  456. If store[p] = 72  Then DrawText "[", cnt*10,v*10
  457. If store[p] = 73  Then DrawText "]", cnt*10,v*10
  458. If store[p] = 74  Then DrawText "+", cnt*10,v*10
  459. If store[p] = 75  Then DrawText "&", cnt*10,v*10
  460. If store[p] = 76  Then DrawText "#", cnt*10,v*10
  461. If store[p] = 77  Then DrawText ";", cnt*10,v*10
  462. If store[p] = 78  Then DrawText ":", cnt*10,v*10
  463. If store[p] = 79  Then DrawText "@", cnt*10,v*10
  464. If store[p] = 80  Then DrawText "?", cnt*10,v*10
  465. If store[p] = 81  Then DrawText "_", cnt*10,v*10
  466. If store[p] = 82  Then DrawText "%", cnt*10,v*10
  467. If store[p] = 83  Then DrawText "!", cnt*10,v*10
  468. If store[p] = 84  Then DrawText " ", cnt*10,v*10
  469. If store[p] = 0  Then DrawText " ", cnt*10,v*10
  470.  
  471. p = p + 1
  472. If p > 4079 Then p = p - 1
  473.  
  474.  
  475.  
  476.  
  477.  
  478. Next
  479. Next
  480.  
  481. End Function
  482.  
  483. End


Comments : none...

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal