Packagecalista.hash
Classpublic class SHA1
InheritanceSHA1 Inheritance Object

SHA-1 is one of the most secure hash algorithms.

A hash is not ‘encryption’ – it cannot be decrypted back to the original text (it is a ‘one-way’ cryptographic function, and is a fixed size for any size of source text). This makes it suitable when it is appropriate to compare ‘hashed’ versions of texts, as opposed to decrypting the text to obtain the original version. Such applications include stored passwords, challenge handshake authentication, and digital signatures. Read the good definition of this algorithm in Wikipedia : http://en.wikipedia.org/wiki/SHA-1

This implementation is a ActionScript version of the SHA-1 Cryptographic Hash Algorithm find in the web site : http://www.movable-type.co.uk/

Example :

     import calista.hash.SHA1 ;
     
     var hash:String   = SHA1.encrypt("hello world") ;
     var equal:Boolean = hash == '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed' ;
     
     trace("'hello world' SHA1 result : " + hash + " : " + equal ) ;
     
     // 'hello world' SHA1 result : 2aae6c35c94fcfb415dbe95f408b9ce91ee846ed : true
     
     

Original Javascript implementation :

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

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

See SHA-1 cryptographic hash function



Public Methods
 MethodDefined By
  
encrypt(source:String):String
[static] Encrypt the specified text with the SHA-1 algorithm.
SHA1
Method Detail
encrypt()method
public static function encrypt(source:String):String

Encrypt the specified text with the SHA-1 algorithm.

Example :

         import calista.hash.SHA1 ;
         
         var hash:String = SHA1.encrypt("hello world") ;
         var equal:Boolean = hash == '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed' ;
         
         trace("'hello world' SHA1 result : " + hash + " : " + equal ) ;
         

Parameters

source:String

Returns
String