mkv

kks table csum

mkv
Oct 26th, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.39 KB | None | 0 0
  1.             byte[] buf = new byte[jsonbuf.Length + 5];
  2.             Array.Copy(jsonbuf, 0, buf, 4, jsonbuf.Length);
  3.             buf[buf.Length - 1] = 0;
  4.             xor2(buf, 0x39, 0x03);
  5.             /* ---------------------
  6.              @ eax 0001597B json len +pad?
  7.              * ebx 323EEC68 json buf
  8.              @ ecx 811C9DC5 seed
  9.              * edx 323EEC68 json buf
  10.              * esi 00015971 json len -csum -nul
  11.              * edi 323EEC68 json buf
  12.              * ebp 003EF22C ? 10 f7 3e 00
  13.              * esp 003EF0CC ? eb 48 3f c3
  14.              * eip 017654D0 TabFlow+2A0
  15.              * efl 00000206 ?
  16.              * ---ODITSZAPC
  17.              * ---001000010
  18.              * ---------------------
  19.              * #1  imul ecx, 1000193h
  20.              * #2  movsx eax, al
  21.              * #3  inc edi
  22.              * #4  xor ecx, eax
  23.              * #5  mov al, [edi]
  24.              * #6  test al, al
  25.              * #7  jnz short 17354d0h   #1
  26.              * ----LOOP----
  27.              * #8  cmp ecx, [ebp+var_124]
  28.              * #9  jz valid_file
  29.              * ---------------------
  30.              * 811C9DC5 *=1000193
  31.              * 050C5D1F ^=eax(7b)
  32.              * 050C5D64
  33.              * ---------------------
  34.              * 050C5D64 *=1000193
  35.              * 5677046C ^=eax(22)
  36.              * 5677044E
  37.              * 5677044E 6B5BC6CA 6B5BC6BE
  38.              * 6B5BC6BE BF79DD1A BF79DD45
  39.              * ---------------------
  40.              * 7b 22 74 5f 63 61 73
  41.              *  "  t  _  c  a  s  t
  42.              */
  43.  
  44.             UInt32 len = (UInt32)(jsonbuf.Length + 0xB);
  45.             byte eax = BitConverter.GetBytes(len)[0];
  46.             eax = 0x7b;
  47.             UInt32 ecx = 0x811C9DC5;
  48.             byte[] csum = new byte[4];
  49.             for (int edi = 4; edi < buf.Length; )
  50.             {
  51.                 ecx *= 0x1000193;
  52.                 csum = BitConverter.GetBytes(ecx);
  53.                 csum[0] ^= BitConverter.GetBytes(eax)[0];
  54.                 if (eax >= 0x80) for (int a = 1; a < csum.Length; a++) csum[a] ^= 0xFF;
  55.                 ecx = BitConverter.ToUInt32(csum, 0);
  56.                 eax = (byte)(buf[++edi] ^ (edi % 2 == 0 ? 0x39 : 0x03));
  57.                 if (eax == 0) break;
  58.             }
  59.             //MessageBox.Show(ecx.ToString("x"));
  60.             csum = BitConverter.GetBytes(ecx);
  61.             Array.Copy(csum, buf, csum.Length);
  62.             File.WriteAllBytes(fout, buf);
Advertisement
Add Comment
Please, Sign In to add comment