Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
 public NekoArchive(ArcView arc, ArchiveFormat impl, ICollection <Entry> dir, INekoEncryption decoder)
     : base(arc, impl, dir)
 {
     Decoder = decoder;
 }
Ejemplo n.º 3
0
 public NekoArchive(ArcView arc, ArchiveFormat impl, ICollection<Entry> dir, INekoEncryption decoder)
     : base(arc, impl, dir)
 {
     Decoder = decoder;
 }
Ejemplo n.º 4
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;
        }