// InitializationVector for 3DES.
        public static Byte[] CalculateIV(UInt32 Seed)
        {
            HashAlgorithm hash = new Tiger();

            return hash.ComputeHash(BitConverter.GetBytes(Seed));
        }
Beispiel #2
0
        public byte[] HashRange(VIRTUAL_ADDRESS KEY, PFN VALUE)
        {
            var rv = new byte[1];

            var block = new long[0x200]; // 0x200 * 8 = 4k
            var bpage = new byte[0x1000];

            var tigger = new Tiger();
            tigger.Initialize();


            //fixed (void* lp = block, bp = bpage)
            //{

            if (DiagOutput)
                WriteColor(VALUE.PTE.Valid ? ConsoleColor.Cyan : ConsoleColor.Red, $"VA: {KEY:X12}  \t PFN: {VALUE.PTE}");

            // if we have invalid (software managed) page table entries
            // the data may be present, or a prototype or actually in swap.
            // for the moment were only going to dump hardware managed data
            // or feel free to patch this up ;)
            if (!VALUE.PTE.Valid)
                return rv;

            if (VALUE.PTE.LargePage)
            {
                bool GoodRead = false;
                // 0x200 * 4kb = 2MB
                for (int i = 0; i < 0x200; i++)
                {
                    MemAccess.GetPageForPhysAddr(VALUE.PTE, ref block, ref GoodRead);
                    VALUE.PTE.PTE += 0x1000;
                    if (!GoodRead)
                        block = new long[0x200];

                    Buffer.BlockCopy(block, 0, bpage, 0, 4096);
                    rv = tigger.ComputeHash(bpage);
                }
                return rv;
            }
            else
            {
                try { MemAccess.GetPageForPhysAddr(VALUE.PTE, ref block); } catch (Exception ex) { }

                if (block != null)
                {
                    Buffer.BlockCopy(block, 0, bpage, 0, 4096);
                    rv = tigger.ComputeHash(bpage);
                }
            }

            return rv;
        }