Skip to content

Instantly share code, notes, and snippets.

@rw-r-r-0644
Last active September 17, 2021 13:21
Show Gist options
  • Save rw-r-r-0644/e73c0e7c80d74bbf7077308e9d8c5805 to your computer and use it in GitHub Desktop.
Save rw-r-r-0644/e73c0e7c80d74bbf7077308e9d8c5805 to your computer and use it in GitHub Desktop.
Obfuscated brainfuck interpreter
/* Copyright (C) 2017 rw-r-r-0644 */
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
char m[1<<16],*o=m,*p;j,k;main(a,b)char**b;{for(k=lseek(j=open(b[1
],0),0,2),lseek(j,0,0),read(j,p=calloc(k+1,1),k);*p;p++){(j=*p)>42
&j<47?j&1?*o+=44-j:j&2?putchar(*o):read(0,o,1):(j&~2)==60?o+=j-61:
0;for(k=abs(j-=92)==1&&j>0^!*o;k;k+=((*(p-=j)==93)-(*p==91))*j);}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment