       }
 
       public function encrypt(block : ByteArray, index : uint = 0) : void {
+         block.position = index;
+         for(var i:uint=0; i< keySize ; i++) {
+            //state.push(block.readUnsignedInt());
+            state[i] = block.readUnsignedInt();
+         }
+         _doCryptBlock(keySchedule,_SUB_MIX_0, _SUB_MIX_1,_SUB_MIX_2,_SUB_MIX_3, _SBOX);
+         block.position = index;
+         for(i=0; i< keySize ; i++) {
+            block.writeUnsignedInt(state[i]);
+         }
       }
 
       public function getBlockSize() : uint {

         nRounds = keySize + 6;
         // Compute number of key schedule rows
         ksRows = (nRounds + 1) * 4;
         key.position=0;
         keyWords = new Vector.<uint>(keySize);
         for(var i:uint=0; i< keySize ; i++) {
            keyWords[i] = key.readUnsignedInt();
         }

      

      public function decrypt(block : ByteArray, index : uint = 0) : void {
         block.position = index;
         for(var i:uint=0; i< keySize ; i++) {
            //state.push(block.readUnsignedInt());
