Show HN: Compile C to Not Gates

(github.com)

123 points | by tomhee16 小时前

17 comments

  • bangaladore16 小时前
    Reminds me of movfuscator [1]. This can compile programs to movs and only movs.

    [1] https://github.com/Battelle/movfuscator

    • LPisGood14 小时前
      Battelle is great. They also created some software called Cantor Dust [1] that turns files into images to allow humans to easily spot obfuscated data or files.

      The sad thing about this kind of work, because I love it, is that to get paid to do it you need clearances and polygraphs and periodic reinvestigations/continuous monitoring and all sorts of things that I find unpleasant.

      [1] https://github.com/Battelle/cantordust

      • mmastrac13 小时前
        I'm not sure what you mean but I was a security researcher for a large company for a bit and required none of that. I was required to work airgapped at home, however.
        • LPisGood13 小时前
          Really? You were doing offensive security work not for a government (/contractor)? What sorts companies, aside from some enterprise pen testers, employ these roles?
          • saagarjha10 小时前
            The tools you’re talking about are not exclusive to offensive security. They’re plenty useful for malware analysis and other reverse engineering tasks.
          • mmastrac13 小时前
            Email is in my profile -- happy to clarify/share some very rough details if you'd like.
    • beng-nl12 小时前
      Agreed that is a fine piece of work. But the author is Chris Domas. Which is plain from the repo readme, but it’d be clearer to link to his repo.
  • dingdingdang1 小时前
    It always amazes me that this is possible (to some extend anyway, I mean, the base layer is binary so obviously simpler higher-end CPU instructions are possible!)

    Is there any potential performance win in this? What I mean is; since this general direction could, in principle if not in practise, enable the targeting of say, the 5-10 most efficient CPU instructions rather than attempting to use the whole surface area... would this potentially be a win?

  • tromp15 小时前
    Am I right in deducing that this language gets its power from self-modifying code? I.e. flipping bits within addresses of the opcodes of the running program?
    • tomhee15 小时前
      You are indeed right
      • tromp15 小时前
        I would have expected the language documentation to focus more on this observation and to explain for instance how self modification is used to implement while loops. But I don't even see the term mentioned anywhere?!
  • eimrine3 小时前
    I was expecting to see a way to translate hello_world.c into an electronic schematic full of NAND elements, kind of Mealy machine.
  • tomhee16 小时前
    There is also a brainfuck to flipjump compiler: https://github.com/tomhea/bf2fj
    • david-gpu14 小时前
      Ah, the convenience of brainfuck with the performance of flipjump. Excellent.
  • pizza13 小时前
    Ah interesting.. wonder if you can model this with a recursively expanded algebraic expression. I've been thinking lately along similar lines about polynomials that encode pushdown automata, so this is cool to see.
    • tomhee13 小时前
      If you have an answer I'd be happy to hear it!
  • tonetegeatinst12 小时前
    Looking forward to the poor security researcher who gets to reverse engineer some malware sample they compiles this into for obfuscation... Its going to be an interesting blog post.
  • jkrshnmenon14 小时前
    I wonder if someone has already made a Reverse Engineering CTF challenge for this concept.
  • dlcarrier14 小时前
    Maxim (now owned by Analog) actually manufactures a single-instruction processor series, called MAXQ. It uses a single move instruction, with a flag for literals, and a transport triggered architecture.
    • Zamiel_Snawley5 小时前
      What is the intended use case for such a processor?
  • tomhee15 小时前
    By the way, as a challenge, try how you can program an "If" statement in Flipjump.
  • 14 小时前
    undefined
  • platz15 小时前
    How is a jump realized by Not Gates?
    • tomhee15 小时前
      I dont think that the jump can be realized by NOT gates, but it's essentially "where to find the next NOT command". The jump is indeed a crucial part of the language, as it allows going back, and especially to make self-modifying code.
    • Jerrrry15 小时前
      I'm guessing by not jumping into a terminating/ halting NOOP.

      The logic is within the branching.

  • jumploops14 小时前
    AND, OR, NOT - pick 2
  • artemonster14 小时前
    Id appreciate more explanations from the power of combined bitflip & goto
  • dang16 小时前
    Looks like we banned you and this domain because of the egregious vote manipulation and bogus comments at https://news.ycombinator.com/item?id=34856792.

    That was a long time ago, though, and the project is interesting enough, so I'm going to assume you've learned your lesson and unban you. Please stop using multiple accounts for this though!

    • tomhee16 小时前
      Thanks man, I appreciate it.
    • jimbob4516 小时前
      Dang, I have to know what triggered you to say this. It’s not the same user account so you would have had to have recognized the URL and written based on that.

      Do you keep notes on each astroturfed submission and auto-trigger reposts to notify yourself? Or did you just happen to recognize this? 20 minutes from his post to your comment is absurdly good moderation.

  • jpcookie13 小时前
    [dead]
  • kuringganteng5 小时前
    [flagged]