Search content:

 

Personal Menu
Username:
Password:
Save password

Become a member

Forgot Password?

 

Don't miss these
Cool Control Button
Drag Light-Alphamania
Behavior Writer
Behavior Writer
Animated Slider Puzzle by J.R.D.R.
All Purpose Status Bar
Psycho Pong
Director-3D.com
The Complete Uninstall
Pass handler to next Sprite
MediaMacros Xtras Mall
 

 

 

Behavior Text Encryption

Added on 1/8/2001

 

Compatibilities:
behavior D7 D8 PC Shockwave

Rating:

Author: JaiGanesh

Just create a text field "entext" and two buttons, one for encryption and one for decryption. Attach the codes and start encrypting.

Logic for encryption
********************

global ftext
-- Each element in this list is a character entered in the field "entext"
global keylist
-- A list containing the key generated for each character.
global orvalues
-- A list containing the original ascii values.
global tch
global decr
-- A flag set when decryption is activated
global encr
-- A flag which is set when encryption is activated.

property totchars
-- Total number of characters entered in field "entext"
property tchar
property rkey
-- A random number between -700 and 700 which is added to the ascii value of
-- each character entered.

on mouseUp
  if encr = 0 then
    x =  the text of field "entext"
    if x = "" then
      alert "Please enter text into the field"
      updatestage
    end if
    totchars = the number of chars of field "entext"
    tch = totchars
    repeat with y = 1 to totchars
      append ftext, char y of field "entext"
      updatestage
    end repeat
    set the text of field "entext" to empty
    repeat with z = 1 to totchars
      -- Adding a random key generated to the key list
      rkey = random(-700,700)
      append keylist, rkey
      put keylist
      tchar = chartonum(ftext[z]) + rkey
      append orvalues, tchar
      put tchar after member "entext"
    end repeat
    encr = 1
    decr = 0
  else
    nothing
  end if
end

************************************************************

Logic for Decryption
********************

global keylist
global orvalues
global tch
global decr
global encr
property tvar

on mouseUp
  if decr = 0 then
    set the text of field "entext" to empty
    updatestage
    repeat with s = 1 to tch
      tvar = numtochar(orvalues[s] - keylist[s])
      put tvar after field "entext"
      updatestage
    end repeat
    decr = 1
    encr = 0
  else
    nothing
  end if
end

 


Upload Provided by ABCUpload ASP

Contact

MMI
22 West Court Sq
Suite 2C
Newnan, GA 30263
USA

Fax - (206) 339-5833

Send e-mail