Reproduced with permission from Penworks Lingo User"s Journal
global cryptKey
global cryptPos
global cryptLen
on resetCrypt
set cryptPos =1
end
on setCryptKey whichKey
set cryptKey =whichKey
set cryptLen =length(cryptKey)
resetCrypt
end
on encrypt whichString, resetkey
if not (integerP(resetKey) and (resetkey = FALSE)) then
resetCrypt
end if
set len =length(whichString)
set newString =""
repeat with x=1 to len
set thisChar =char x of whichString
set thisCharNum =charToNum(thisChar)
set keyChar =char cryptPos of cryptKey
-- Advance the crypt key
set cryptPos =cryptPos + 1
if cryptPos > cryptLen then
resetCrypt
end if
set keyCharNum =charToNum(keyChar)
set newCharNum =xorbin(thisCharNum, keyCharNum)
set newCharNum =newCharNum + 1
set newChar =numToChar(newCharNum)
set newString =newString & newChar
end repeat
return(newString)
end
on decrypt whichString, resetkey
if not (integerP(resetKey) and (resetkey = FALSE)) then
resetCrypt
end if
set len =length(whichString)
set newString =""
repeat with x=1 to len
set thisChar =char x of whichString
set thisCharNum =charToNum(thisChar)
set thisCharNum =thisCharNum -1
set keyChar =char cryptPos of cryptKey
-- Advance the crypt key
set cryptPos =cryptPos + 1
if cryptPos > cryptLen then
resetCrypt
end if
set keyCharNum =charToNum(keyChar)
set newCharNum =xorbin(thisCharNum, keyCharNum)
set newChar =numToChar(newCharNum)
set newString =newString & newChar
end repeat
return(newString)
end
Contact
MMI
36 South Court Sq
Suite 300
Newnan, GA 30263
USA