Пример #1
0
 public void setBlockCrypt(byte[] input, int index)
 {
     //Encrypt
     byte[] encrypt = new byte[getBlockLength(index)];
     encrypt = PKX5.cryptoArray(input, blocks[index].crypto.start, blocks[index].crypto.length, blocks[index].crypto.seed);
     setBlock(encrypt, index);
 }
Пример #2
0
        public byte[] getBlockDec(int index)
        {
            byte[] decrypt = new byte[getBlockLength(index)];

            int blocksnum    = 0;
            int backupoffset = 0;

            if (B2W2)
            {
                blocksnum    = CrcTableBW2;
                backupoffset = SIZE2;
            }
            else if (BW)
            {
                blocksnum    = CrcTableBW;
                backupoffset = SIZE1;
            }
            else
            {
                return(null);
            }

            if (index < blocksnum)
            {
                //MessageBox.Show(decrypt.Length.ToString());
                //MessageBox.Show((blocks[index].Length-4).ToString());
                decrypt = PKX5.cryptoArray(Data.Skip(blocks[index].Offset).Take(blocks[index + 1].Offset - blocks[index].Offset).ToArray(), blocks[index].crypto.start, blocks[index].crypto.length, blocks[index].crypto.seed);
                //MessageBox.Show((blocks[index].Length-4).ToString());
                return(decrypt);
            }
            else if (index == 73)
            {
                return(Data.Skip(blocks[index].Offset).Take(backupoffset - blocks[index].Offset).ToArray());
            }
            else
            {
                return(null);
            }
        }