top secret confidential
play

TOP SECRET CONFIDENTIAL 1 TOP SECRET WITCHCRAFT SECRETS - PowerPoint PPT Presentation

TOP SECRET CONFIDENTIAL 1 TOP SECRET WITCHCRAFT SECRETS CONFIDENTIAL 2 Witchcraft Secrets ...from a reverse-engineer Alyssa Rosenzweig Starswirls First Law Magic can neither be created nor destroyed 4 Starswirls First Law


  1. TOP SECRET CONFIDENTIAL 1

  2. TOP SECRET WITCHCRAFT SECRETS CONFIDENTIAL 2

  3. Witchcraft Secrets ...from a reverse-engineer Alyssa Rosenzweig

  4. Starswirl’s First Law Magic can neither be created nor destroyed… 4

  5. Starswirl’s First Law Magic can neither be created nor destroyed… ….only transformed. 5

  6. Starswirl’s First Law 6

  7. Starswirl’s First Law 7

  8. Starswirl’s First Law 8

  9. Witchcraft 9

  10. OPEN SORCERY 10

  11. STEPS 11

  12. Steps - trivial ● Write a test ● Trace baseline input ● Trace with single “interesting” change ● Difg the traces ● Single change? Lucky. 12

  13. Spelling convention 13

  14. Steps - nontrivial ● Write a test ● Trace many inputs ● Record results ● Find a pattern ● Deduce f ● Rewrite for 14

  15. Steps - nontrivial ● Write a test ● Trace many inputs ● Record results ● Find a pattern ● Deduce f ● Rewrite for 15

  16. TRACING 16

  17. 17

  18. 18

  19. Steps - nontrivial ● Write a test ● Trace many inputs ● Record results ● Find a pattern ● Deduce f ● Rewrite for 19

  20. TECHNIQUES 20

  21. Waiting ● Cuss on IRC. ● Wait for a draconequus to whisper f to you. Works 20% of the time 21

  22. Law of Parsimaney ● Simple f are more likely than complex f . ● Simple for the hardware , not for you! ● Think like a hardware designer (gate count). 22

  23. Properties ● Alignment? ● Monotonicity? ● Linear? Almost linear? ● Bitwise complements? ● Powers of two? 23

  24. Information entropy ● Input entropy vs output bit count ● Equal entropy: just shuffming ● More in input: incomplete encoding (pigeonhole) ● More in output: incomplete input (Occam's Razor) 24

  25. Graphs 25

  26. Calculus ● Discrete derivatives (backwards difgerencing) ● Sometimes modeling f’ is easier than f . ● Integrate f’ to recover f (summation) Useful for near-linear f 26

  27. Classes of f ● What kind of function could satisfy the properties? ● Closed-form algebraic? ● Bitwise manipulation? ● Try some. 27

  28. Purpose ● Every fjeld has a reason for being. ● Your job: fjgure out why. 28

  29. Purpose struct texture { unsigned width ; unsigned unknown ; unsigned depth ; ... 29

  30. Purpose struct texture { unsigned width ; unsigned height ; unsigned depth ; ... 30

  31. Purpose Proximate fjelds have proximate purposes. 31

  32. Info drops ● Know the hardware, know the purpose. ● Conference slides. ● Vendor blogs. ● Code drops (kernel) ● Google is your friend. 32

  33. XDC Hallway Track [redacted] 33

  34. If all else fails... ● Move on. ● Lots of seaponies in the sea. 34

  35. EXAMPLE 35

  36. 1 if (vColor.x < 0.5) discard; flt r31.w, r0.x, #0.5 br.discard.true 36

  37. 2 - AND if (vColor.x < 0.5 && vColor.y < 0.75) discard; flt r31.w, r0.y, #0.75 flt r31.w, r0.x, #0.5 brx.discard. unk8888 37

  38. 2 - OR if (vColor.x < 0.5 || vColor.y < 0.75) discard; flt r31.w, r0.y, #0.75 flt r31.w, r0.x, #0.5 brx.discard. unkEEEE 38

  39. 2 - NAND if (!(vColor.x < 0.5 && vColor.y < 0.75)) discard; flt r31.w, r0.y, #0.75 flt r31.w, r0.x, #0.5 brx.discard. unk1111 39

  40. 2 - NOR if (!(vColor.x < 0.5 || vColor.y < 0.75)) discard; flt r31.w, r0.y, #0.75 flt r31.w, r0.x, #0.5 brx.discard. unk7777 40

  41. Expression Code (A && B) 8888 (A || B) EEEE !(A && B) 7777 !(A || B) 1111 41

  42. 3? if (vColor.x < 0.5 && vColor.y < 0.75 && vColor.z == 1.0) discard; flt r31.x, r0.y, #0.75 feq r31.w, r0.z, #1 flt r31.w, r0.x, #0.5 brx.discard. unk8080 42

  43. 4? if (vColor.x < 0.5 && vColor.y < 0.75 && vColor.z == 1.0 && vColor.w == 0.0) discard; feq r31.w, r0.z, #1 feq r31.w, r0.w, #0 flt r31.x, r0.y, #0.75 flt r31.w, r0.x, #0.5 brx.discard. unk8000 43

  44. 5? if (vColor.x < 0.5 && vColor.y < 0.75 && vColor.z == 1.0 && vColor.w == 0.0 && vColor.x > vColor.y) discard; ... iand r31.w, r0.z, r0.w brx.discard.unk8000 44

  45. Expression Code (A && B) 8888 (A || B) EEEE !(A && B) 7777 !(A || B) 1111 (A && B) && C 8080 (A && B) && C && D 8000 45

  46. Mathemagics 46

  47. Expression Code (A && B) 8888 (A || B) EEEE !(A && B) 7777 !(A || B) 1111 (A && B) && C 8080 (A && B) && C && D 8000 47

  48. Expression Code (A && B) 8888 !(A && B) 7777 (A || B) EEEE !(A || B) 1111 48

  49. Expression Code (A && B) 8888 FFFF !(A && B) 7777 (A || B) EEEE FFFF !(A || B) 1111 49

  50. Expression Code (A && B) && C && D 8000 0 0 0 0 0 0 0 0 0 0 . . . . . . 0 0 0 0 1 1 50

  51. Expression Code (A && B) 8888 (A || B) EEEE !(A && B) 7777 !(A || B) 1111 (A && B) && C 8080 (A && B) && C && D 8000 51

  52. LUT 52

  53. Thank you! 53

  54. TOP SECRET CONFIDENTIAL 54

Recommend


More recommend