Packagecalista.hash
Classpublic class Blowfish
InheritanceBlowfish Inheritance Object

Blowfish is a keyed, symmetric block cipher, designed in 1993 by Bruce Schneier and included in a large number of cipher suites and encryption products. Blowfish provides a good encryption rate in software and no effective cryptanalysis of it has been found to date.

Example :

     import calista.hash.Blowfish ;
     var blowfish:Blowfish = new Blowfish("calista") ;
     trace( blowfish.encrypt( "hello world" ) ) ; // "09B162A36AF69F66699E5BAE6CF11B3C"
     trace( blowfish.decrypt( "09B162A36AF69F66699E5BAE6CF11B3C" ) ; // hello world
     



Public Properties
 PropertyDefined By
  key : String
The key of the blowfish algorithm.
Blowfish
  p : Array
Blowfish
  s0 : Array
Blowfish
  s1 : Array
Blowfish
  s2 : Array
Blowfish
  s3 : Array
Blowfish
  xl_par : Number
Blowfish
  xr_par : Number
Blowfish
Public Methods
 MethodDefined By
  
Blowfish(key:String = null)
Creates a new Blowfish instance.
Blowfish
  
decrypt(cipher:String):String
Use Blowfish algorithm to decrypt ciphertext using key.
Blowfish
  
decrypt(cipher:String, key:String):String
[static] Use Blowfish algorithm to decrypt ciphertext using key.
Blowfish
  
encrypt(source:String):String
Uses Blowfish algorithm to encrypt a string value using key.
Blowfish
  
encrypt(source:String, key:String):String
[static] Uses Blowfish algorithm to encrypt a string value using key.
Blowfish
Public Constants
 ConstantDefined By
  singleton : Blowfish
[static] The blowfish singleton reference.
Blowfish
Property Detail
keyproperty
key:String

The key of the blowfish algorithm.


Implementation
    public function get key():String
    public function set key(value:String):void
pproperty 
public var p:Array

s0property 
public var s0:Array

s1property 
public var s1:Array

s2property 
public var s2:Array

s3property 
public var s3:Array

xl_parproperty 
public var xl_par:Number

xr_parproperty 
public var xr_par:Number

Constructor Detail
Blowfish()Constructor
public function Blowfish(key:String = null)

Creates a new Blowfish instance.

Parameters
key:String (default = null)
Method Detail
decrypt()method
public function decrypt(cipher:String):String

Use Blowfish algorithm to decrypt ciphertext using key.

Example :

         import calista.hash.Blowfish ;
         var blowfish:Blowfish = new Blowfish("calista") ;
         trace( blowfish.decrypt( "09B162A36AF69F66699E5BAE6CF11B3C" ) ; // hello world
         

Parameters

cipher:String — String to be decrypted.

Returns
String — The decrypted text.
decrypt()method 
public static function decrypt(cipher:String, key:String):String

Use Blowfish algorithm to decrypt ciphertext using key.

Example :

         import calista.hash.Blowfish ;
         trace( Blowfish.decrypt( "09B162A36AF69F66699E5BAE6CF11B3C" , "calista" ) ; // hello world
         

Parameters

cipher:String — String to be decrypted.
 
key:String

Returns
String — The decrypted text.
encrypt()method 
public function encrypt(source:String):String

Uses Blowfish algorithm to encrypt a string value using key.

Example :

         import calista.hash.Blowfish ;
         var blowfish:Blowfish = new Blowfish("calista") ;
         trace( blowfish.encrypt( "hello world" ) ) ; // "09B162A36AF69F66699E5BAE6CF11B3C"
         

Parameters

source:String — The source to encrypt.

Returns
String — The encrypted cypher text as string.
encrypt()method 
public static function encrypt(source:String, key:String):String

Uses Blowfish algorithm to encrypt a string value using key.

Example :

         import calista.hash.Blowfish ;
         trace( Blowfish.encrypt( "hello world" , "calista" ) ) ; // "09B162A36AF69F66699E5BAE6CF11B3C"
         

Parameters

source:String — The source to encrypt.
 
key:String — The key used to encrypt.

Returns
String — The encrypted cypher text as string.
Constant Detail
singletonConstant
public static const singleton:Blowfish

The blowfish singleton reference.