Packagecalista.hash
Classpublic final class CRC32
InheritanceCRC32 Inheritance Object

A cyclic redundancy check (CRC) is a non-secure hash function designed to detect accidental changes to raw computer data, and is commonly used in digital networks and storage devices such as hard disk drives. This algorithm is used in the GZIP file format specification version 4.3 defines in the RFC 1952.

Example :

     package examples 
     {
         import calista.hash.CRC32;
         
         import flash.display.Sprite;
         import flash.utils.ByteArray;
         
         public class CRC32Example extends Sprite 
         {
             public function CRC32Example()
             {
                 var bytes:ByteArray = new ByteArray() ;
                 bytes.writeUTFBytes("hello world") ;
                 
                 var sum:uint = CRC32.checkSum(bytes) ;
                 
                 trace("CRC32 : " + sum + " 0x" + sum.toString( 16 ).toUpperCase() ) ; // CRC32 : 222957957 0xD4A1185
             }
         }
     }
     



Public Methods
 MethodDefined By
  
checkSum(buffer:ByteArray, index:uint = 0, length:uint = 0):uint
[static] Generates the checksum of the specified ByteArray with the CRC32 algorithm.
CRC32
Method Detail
checkSum()method
public static function checkSum(buffer:ByteArray, index:uint = 0, length:uint = 0):uint

Generates the checksum of the specified ByteArray with the CRC32 algorithm.

Parameters

buffer:ByteArray — the buffer ByteArray object which contains the datas.
 
index:uint (default = 0) — The index to begin the buffering (default 0).
 
length:uint (default = 0) — The length value to limit the buffering (if this value is 0, the length of the ByteArray is used).

Returns
uint