Contents
Articles
Behaviors
Books
Director News
Director Web Sites
FAQ
Games
Mailing Lists
News Groups
Project Examples
Reviews
Software
Tools
Useful Web Sites
Utilities
Xtras

Don't miss these
simMode4.0 For multi-moniter
Scrollable Sprites
ChromeLib
cXtraSendMail
Image capture Xtra
Set Static Property of a Flash sprite
QTRecordAudioXtra
ADOxtra for Shockwave Multiuser Server
ZGTSB-TextInteractivity
Send to Top
 

 

 

Behavior More encryption

Added on 7/8/1999

 

Compatibilities:
D6_5 D7 D8 Mac PC Script Shockwave

Rating:

Author: Penworks (website)

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

Send e-mail