DECLARE FUNCTION encrypt(text AS STRING, pass AS STRING)AS STRING
DECLARE FUNCTION decrypt(text AS STRING, pass AS STRING)AS STRING
FUNCTION encrypt
DIM a AS INTEGER:DIM lettert AS STRING:DIM letterp AS STRING
DIM asct AS INTEGER:DIM ascp AS INTEGER:DIM count AS INTEGER
count = 1
FOR a = 1 TO LEN(text)
lettert = MID$(text, a,1)
letterp = MID$(pass, count,1)
asct = ASC(lettert)
ascp = ASC(letterp)
asct = asct + ascp
IF asct > 255 THEN asct = asct - 255
lettert = CHR$(asct)
Result = Result & lettert
count = count + 1
IF count > LEN(pass) THEN count = 1
NEXT a
END FUNCTION
FUNCTION decrypt
DIM a AS INTEGER:DIM lettert AS STRING:DIM letterp AS STRING
DIM asct AS INTEGER:DIM ascp AS INTEGER:DIM final AS STRING
DIM count AS INTEGER
count = 1
FOR a = 1 TO LEN(text)
lettert = MID$(text, a,1)
letterp = MID$(pass, count,1)
asct = ASC(lettert)
ascp = ASC(letterp)
asct = asct - ascp
IF asct > 255 THEN asct = asct - 255
lettert = CHR$(asct)
Result = Result & lettert
count = count + 1
IF count > LEN(pass) THEN count = 1
NEXT a
END FUNCTION
|