Langeweile

This site uses cookies. By continuing to browse this site, you are agreeing to our use of cookies. More details

  • Tja, was für eine Ausgabe wird wohl erzeugt werden ???


    C Source Code

    1. #include <stdio.h>
    2. #include <stdlib.h>
    3. #include <string.h> // "strlen"
    4. #include <ctype.h> // "islower"
    5. #define I 73
    6. #define L "6c696b65"
    7. #define C 0x1234
    8. char *x(const char *);
    9. void comp(const char *);
    10. uint8_t nibbleFromChar(char);
    11. uint8_t *hexStringToBytes(char *);
    12. int main(int argc, char **argv)
    13. {
    14. printf("%c %s the %s ", I, hexStringToBytes(L), x("GSZ]\\@")); comp("pbzcyvpngrq");
    15. putchar('\n');
    16. return EXIT_SUCCESS;
    17. }
    18. char *x(const char *m)
    19. {
    20. int len = strlen(m);
    21. int i = 0, j = len;
    22. char *str = malloc(sizeof(char *) * (len + 1));
    23. *(str + len + 1) = '\0';
    24. while((len-- > 0) && (i <= j))
    25. *(str+i++) = *(m+len) ^ C;
    26. return str;
    27. }
    28. void comp(const char *m)
    29. {
    30. while( *m )
    31. putchar( ((*m++ - (int)(islower(*(m - 1)) ? 'a' : 'A') + 13) % 26) + (int)(islower(*(m - 1)) ? 'a' : 'A') );
    32. }
    33. uint8_t nibbleFromChar(char c)
    34. {
    35. if(c >= '0' && c <= '9') return c - '0';
    36. if(c >= 'a' && c <= 'f') return c - 'a' + 10;
    37. if(c >= 'A' && c <= 'F') return c - 'A' + 10;
    38. return 255;
    39. }
    40. uint8_t *hexStringToBytes(char *inhex)
    41. {
    42. uint8_t *retval;
    43. uint8_t *p;
    44. int len, i;
    45. len = strlen(inhex) >> 1;
    46. retval = malloc(len + 1);
    47. for(i = 0, p = (uint8_t *) inhex; i < len; i++) {
    48. retval[i] = (nibbleFromChar(*p) << 4) | nibbleFromChar(*(p+1));
    49. p += 2;
    50. }
    51. retval[len] = 0;
    52. return retval;
    53. }
    Display All