08-16-2005, 06:10 AM
Code:
declare function Encrypt (Msg As STRING, Pwd As STRING) As STRING
declare function Decrypt (Msg As STRING, Pwd As STRING) As STRING
function Encrypt (Msg As STRING, Pwd As STRING) As STRING
dim pavg as integer, i as integer, i2 as integer
for i = 1 to len(pwd)
pavg=pavg+asc(mid$(pwd,i,1))+i
next i
pavg=pavg/len(pwd)
if pavg>255 then pavg=255-pavg
for i=1 to len(msg)
i2=asc(mid$(msg,i,1))+pavg+i+len(pwd)
if i2>255 then i2=255-i2
mid$(msg,i,1)=chr$(i2)
next i
return msg
end function
function Decrypt (Msg As STRING, Pwd As STRING) As STRING
dim pavg as integer, i as integer, i2 as integer
for i = 1 to len(pwd)
pavg=pavg+asc(mid$(pwd,i,1))+i
next i
pavg=pavg/len(pwd)
if pavg>255 then pavg=255-pavg
for i=1 to len(msg)
i2=asc(mid$(msg,i,1))-pavg-i-len(pwd)
if i2<0 then i2=i2+255
mid$(msg,i,1)=chr$(i2)
next i
return msg
end function
Probably sucks but I'm too lazy to care =P
EDIT: *wonders why the tabs look lined up in the post but not after submitted*