Hey everyone! Wrote two little functions that will encrypt/decrypt any given string with the two keys rawkey$ (it will be redefined after completing the first encryption). The two encryptions on top of each other also make bruteforcing pretty much impossible.
The code generated is different each time, even with the same input and the same keys.
Use this for your programs when saving passwords or other data you don't want to be read out ;)
I also wrote a program that will do the same, but you'll have a little menu to navigate around and can easily copy/paste data to/from clipboard if you don't want to automatically write files but e.g. send messages or similar:
https://loudar.myportfolio.com/cara'variables for encryption
length = 1000
'variables for decryption
encrun = 0
encrun = encrun + 1
rawkey$ = "enter the first key here"
rawkey$ = "enter the second key here"
c = 0
c = c + 1
genRNDLET:
rndlet
(c
) = INT(RND * 90) + 32 addlet$
(c
) = CHR$(rndlet
(c
))
genFINALASC:
l = 0
l = l + 1
keylet$
= MID$(rawkey$
, l
, 1) keyasc
(c
) = keyasc
(c
) + ASC(keylet$
) rawlet$
(c
) = MID$(rawdata$
, c
, 1) finalASC
(c
) = ASC(rawlet$
(c
)) + keyasc
(c
) + rndlet
(c
)
toadd$
(c
) = addlet$
(c
) + MID$(STR$(finalASC
(c
)), 2, LEN(STR$(finalASC
(c
) - 1))) edata$ = edata$ + toadd$(c)
rawdata$ = edata$
encrypt$ = edata$
rawkey$ = ""
decrun = 0
decrun = decrun + 1
rawkey$ = "enter the second key from encrypt$ here"
rawkey$ = "enter the first key from encrypt$ here"
u = 0
u = u + 1
number$(u) = ""
l = 0
l = l + 1
keyasc(l) = 0
c = 0
letpos = 0
letpos = letpos + 1
c = c + 1
rndlet
(c
) = ASC(MID$(edata$
, letpos
, 1)) findpos(c) = letpos
endsearch = 0
letpos = letpos + 1
endsearch = 1
endsearch = 1
endsearch:
letpos = letpos - 1
numbers = letpos - findpos(c)
u = 0
u = u + 1
number$
(c
) = number$
(c
) + MID$(edata$
, findpos
(c
) + u
, 1) ascvalue
(c
) = VAL(number$
(c
)) l = 0
l = l + 1
keylet$
= MID$(rawkey$
, l
, 1) keyasc
(c
) = keyasc
(c
) + ASC(keylet$
) cryptletter$
(c
) = CHR$(ascvalue
(c
) - keyasc
(c
) - rndlet
(c
)) rawdata$ = rawdata$ + cryptletter$(c)
continue:
edata$ = rawdata$
decrypt$ = rawdata$
rawdata$ = ""