Packagecalista.hash
Classpublic class TEA
InheritanceTEA Inheritance Object

Since : FlashPlayer 10

Wheeler and Needham’s Tiny Encryption Algorithm is a simple but powerful encryption algorithm (based on a ‘Feistel cipher’).

Example :

     import calista.hash.TEA ;
     
     var source:String = "hello world is secret" ;
     var password:String = "calista" ;
     
     var encrypt:String = TEA.encrypt( source , password ) ;
     trace("encrypt : " + encrypt) ;
     
     var decrypt:String = TEA.decrypt(encrypt , password) ;
     trace("decrypt : " + decrypt) ;
     

Original implementation :

Chris Veness, Movable Type Ltd: www.movable-type.co.uk

Algorithm: David Wheeler and Roger Needham, Cambridge University Computer Lab

See Tiny Encryption Algorithm

See also

calista.utils.Base64


Public Methods
 MethodDefined By
  
decrypt(cipher:String, key:String):String
[static] Use Corrected Block TEA to decrypt ciphertext using key.
TEA
  
encrypt(source:String, key:String):String
[static] Uses corrected Block TEA to encrypt a string value using key.
TEA
Method Detail
decrypt()method
public static function decrypt(cipher:String, key:String):String

Use Corrected Block TEA to decrypt ciphertext using key.

Parameters

cipher:String — String to be decrypted.
 
key:String — The password to be used for decryption (1st 16 chars).

Returns
String — The decrypted text
encrypt()method 
public static function encrypt(source:String, key:String):String

Uses corrected Block TEA to encrypt a string value using key.

Parameters

source:String — The source to encrypt.
 
key:String — The password key to encrypt the source (1st 16 chars).

Returns
String — The encrypted text as string.