File "BasileCodec.inc"
Path: /ickvdo/inc/BasileCodec.inc
File size: 1.06 KB
MIME-type:
Charset: utf-8
'-------------------------------------------------------------------------------
FUNCTION BasileCodec (str AS STRING, pwd AS STRING, sens AS INTEGER) AS STRING
LOCAL res AS STRING
LOCAL ind AS INTEGER
ind = 1 : res = ""
FOR i% = 1 TO LEN(str)
res = res + CHR$( ( 256 + ASC(MID$(str, i%, 1)) + sens * ASC(MID$(pwd, ind, 1)) ) MOD 256 )
ind = ( ind MOD LEN(pwd) ) + 1
NEXT i%
BasileCodec = res
END FUNCTION
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
FUNCTION BasileEncode (str AS STRING, pwd AS STRING) AS STRING
FUNCTION = BasileCodec(str, pwd, 1)
END FUNCTION
'-------------------------------------------------------------------------------
'-------------------------------------------------------------------------------
FUNCTION BasileDecode (str AS STRING, pwd AS STRING) AS STRING
FUNCTION = BasileCodec(str, pwd, -1)
END FUNCTION
'-------------------------------------------------------------------------------