Skip to content

Instantly share code, notes, and snippets.

@coinconclusive
Last active January 15, 2023 18:53
Show Gist options
  • Select an option

  • Save coinconclusive/7ba04129af2f4342f6cb9420430c0e47 to your computer and use it in GitHub Desktop.

Select an option

Save coinconclusive/7ba04129af2f4342f6cb9420430c0e47 to your computer and use it in GitHub Desktop.

Revisions

  1. coinconclusive revised this gist Jan 15, 2023. 1 changed file with 8 additions and 10 deletions.
    18 changes: 8 additions & 10 deletions obfuscated0.c
    Original file line number Diff line number Diff line change
    @@ -1,15 +1,13 @@
    // this compiles with -Wall -Wpedantic -Werror //

    /*****************************/
    /**/int s2i(char**s,int*n){/**/
    /**/int z=1;for(*n=0;**s>47/**/
    /**/;z*=10)*n=*n*10+*(*s)++/**/
    /**/-48;;return z;}void s2f/**/
    /**/(char**s,float*f){int n/**/
    /**/,z;s2i(s,&n);*f=n;+**s^/**/
    /**/46?0:(*f+=(++*s,z=s2i(s/**/
    /**/,&n),(n+0.f)/z));}/*annie*/
    /*****************************/
    int s2i(char**s,int*n){
    int z=1;for(*n=0;**s>47
    ;z*=10)*n=*n*10+*(*s)++
    -48;;return z;}void s2f
    (char**s,float*f){int n
    ,z;s2i(s,&n);*f=n;+**s^
    46?0:(*f+=(++*s,z=s2i(s
    ,&n),(n+0.f)/z));}/*a*/

    // example usage: //

  2. coinconclusive revised this gist Jan 15, 2023. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions obfuscated0.c
    Original file line number Diff line number Diff line change
    @@ -13,6 +13,10 @@

    // example usage: //

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>

    int main() {
    char s1[] = "123.456";
    char *s2 = malloc(8);
  3. coinconclusive created this gist Jan 15, 2023.
    27 changes: 27 additions & 0 deletions obfuscated0.c
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    // this compiles with -Wall -Wpedantic -Werror //

    /*****************************/
    /**/int s2i(char**s,int*n){/**/
    /**/int z=1;for(*n=0;**s>47/**/
    /**/;z*=10)*n=*n*10+*(*s)++/**/
    /**/-48;;return z;}void s2f/**/
    /**/(char**s,float*f){int n/**/
    /**/,z;s2i(s,&n);*f=n;+**s^/**/
    /**/46?0:(*f+=(++*s,z=s2i(s/**/
    /**/,&n),(n+0.f)/z));}/*annie*/
    /*****************************/

    // example usage: //

    int main() {
    char s1[] = "123.456";
    char *s2 = malloc(8);
    memcpy(s2, s1, sizeof(s1));

    char *s3 = s2;
    float x;
    s2f(&s3, &x);

    printf("%s -> %f\n", s2, x);
    free(s2);
    }