Beispiel #1
0
        static byte[] ReadBlock(ArcView.Frame view, INekoFormat enc, long offset, out int length)
        {
            uint hash = view.ReadUInt32(offset);

            length = view.ReadInt32(offset + 4);

            int aligned_size = (length + 7) & ~7;

            byte[] buffer = new byte[aligned_size];
            length = view.Read(offset + 8, buffer, 0, (uint)length);
            if (0 != hash)
            {
                enc.Decrypt(hash, buffer, 0, aligned_size);
            }
            return(buffer);
        }
Beispiel #2
0
        static byte[] ReadBlock(ArcView.Frame view, INekoEncryption enc, long offset, out int length)
        {
            uint hash = view.ReadUInt32(offset);

            length = view.ReadInt32(offset + 4);
            // parity check
//            if (CalcParity (((NekoEncryption32bit)enc).Parity, (uint)length) != hash)
//                throw new InvalidFormatException();

            int aligned_size = (length + 7) & ~7;

            byte[] buffer = new byte[aligned_size];
            length = view.Read(offset + 8, buffer, 0, (uint)length);
            if (0 != hash)
            {
                enc.Decrypt(hash, buffer, 0, aligned_size);
            }
            return(buffer);
        }