9
« on: May 07, 2019, 09:53:36 pm »
DECLARE SUB Rndmiz ()
DECLARE FUNCTION Grand! ()
DIM SHARED Pad1$(15), Pad2$(15), ToByte(63), ToB64(255), Mods(12)
COMMON SHARED L0, L1, L2, L3, ToB64(), L5, ToByte(), L7, Mods(), L9, L10$
COMMON SHARED L11$, L13$, I14, I15, I17, L20, Pad1$(), Pad2$(), L26$, L28$, I29
COMMON SHARED I34, L35, L36, L37$, I38, I39, L40!, I42, Modder2, L44, L45
COMMON SHARED L46, Modder, I50, L51$, L54
L0 = 0
L3 = 255
L1 = 1
L5 = 63
L7 = 12
Modder = 64
Modder2 = 256
110 RANDOMIZE TIMER
120 FOR L2 = L0 TO L3 STEP L1
130 ToB64(INT(L2)) = -1
140 NEXT
150 FOR L2 = L0 TO L5 STEP L1
160 READ ToByte(INT(L2))
170 ToB64(ToByte(INT(L2))) = INT(L2)
180 NEXT
190 FOR L2 = L0 TO L7 STEP L1
200 READ Mods(INT(L2))
210 NEXT
220 L9 = L0
222 SHELL "dir *.* /w /p"
390 INPUT "enter file to encrypt/decrypt"; L26$
400 INPUT "enter name of output file"; L28$
INPUT "enter seed (password)"; L13$
I14 = LEN(L13$)
IF I15 <= 15 THEN GOTO set2max
L13$ = LEFT$(L13$, 15)
set2max: I17 = 15
FOR L2 = L0 TO 15 STEP L1
PRINT "("; L2; ") ";
Pad1$(INT(L2)) = LEFT$(L13$, 1)
L13$ = RIGHT$(L13$, I17)
Pad2$(INT(L2)) = Pad1$(INT(L2))
I17 = I17 - 1
NEXT
430 OPEN L26$ FOR BINARY AS #1
440 OPEN L28$ FOR BINARY AS #2
450 I34 = LOF(1)
REM 460 L35 = 'L35 apparently is not being used...
470 L36 = I34
480 GOTO 600
490 CALL Rndmiz
495 L40! = Grand!
peel& = 32
IF I34 < 32 THEN peel& = I34
510 L37$ = STRING$(peel&, 32)
520 GET #1, I39, L37$
strlen = LEN(L37$)
FOR sloc = 1 TO strlen
CALL Rndmiz
L40! = Grand!
530 IR12 = INT(L40! / 256) '( # Top half of long integer # )
540 IR14 = (INT(L40! * 256)) MOD 256
IF sloc <= LEN(L37$) THEN
bite$ = MID$(L37$, sloc, 1)
550 I42 = ASC(bite$) XOR IR14
560 L37$ = CHR$(I42 MOD Modder2)
END IF
NEXT sloc
570 PUT #2, I39, L37$
580 IF I29 <> 1 THEN GOTO 600
590 PRINT L37$;
600 I39 = I39 + 1
610 I38 = I38 + 1
620 IF I39 <= L36 THEN GOTO 490
630 CLOSE #2
640 CLOSE #1
650 SYSTEM
870 DATA 32,33,34,35,36,37,38,39
880 DATA 40,41,42,43,44,45,46,47
890 DATA 48,49,50,51,52,53,54,55
900 DATA 56,57,58,59,60,61,62,63
910 DATA 64,65,66,67,68,69,70,71
920 DATA 72,73,74,75,76,77,78,79
930 DATA 80,81,82,83,84,85,86,87
940 DATA 88,89,90,91,92,93,94,95
950 DATA 2,3,5,7,11,13,17,19,23,27,33,37,43
960 END
FUNCTION Grand!
L40! = 0!
L54 = .015625
FOR L2 = 13 TO 15 STEP L1
L40! = (ASC((Pad1$(INT(L2)))) - 32) * L54 + L40!
L54 = L54 / 64
NEXT
Grand! = L40!
END FUNCTION
SUB Rndmiz
L45 = Mods(INT(L9))
FOR L46 = 0 TO 3 STEP 1
FOR L2 = 0 TO 15 STEP 1
IF (L2 MOD 2) <> 0 THEN GOTO skp1
L45 = (ASC((Pad1$(INT(L2)))) + -32) + L45
skp1: IF (L2 MOD 2) <> 1 THEN GOTO skp2
L45 = (-(ASC((Pad1$(INT(L2)))) - 95)) + L45
skp2: IF L2 <= L0 THEN GOTO bland01
Pad1$(INT(L2 - 1)) = Pad1$(INT(L2))
bland01: NEXT
I50 = L45 MOD Modder
L51$ = CHR$(ToByte(I50))
L9 = (L9 + L1) MOD 13
NEXT
END SUB
this does not seem to work in the latest version of QB64 I get the message Invalid name on line 96 what is wrong??
There Removed (45 pad$...) on line 96 and the program works FINE!! feel free to copy it and try it out!! Ill be making som minor improvements to it eventually, like having it give you a list of available files, thus letting you more easily select a file etc...