fork download
  1.  
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <ctype.h>
  5. #include <math.h>
  6. #include <string.h>
  7. #define ORIGINAL_STRING_SIZE 10
  8.  
  9. int i;
  10. char bin[][5]={"0000","0001","0010","0011","0100","0101","0110","0111","1000","1001","1010","1011","1100","1101","1110","1111"};
  11. char hex[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
  12.  
  13.  
  14.  
  15. int main()
  16. {
  17. char *cipher="9191ABA49C";
  18. char *dbit;
  19. char *decrypted;
  20. char c;
  21. int move;
  22.  
  23.  
  24. decrypted=(char*)malloc(ORIGINAL_STRING_SIZE*4 +1);
  25.  
  26. for(i=0;i<ORIGINAL_STRING_SIZE;i++){
  27. dbit=(char*)malloc(5);
  28. c=cipher[i];
  29. //printf("\n%c",c);
  30. // converting HEX to DECIMAL
  31.  
  32. if((int)c >= 'A' && (int)c <= 'F')
  33. {
  34. move=10+ (int)(c - 'A');
  35. //printf("%d",move);
  36. }
  37. else{
  38. move=(int)(c-'0');
  39. }
  40. strcpy(dbit,bin[move]);
  41.  
  42. strcat(decrypted,dbit);
  43. }
  44. puts(decrypted);
  45. printf("\n\n%d",strlen(decrypted));
  46. return 0;
  47.  
  48. }
  49.  
  50.  
Success #stdin #stdout 0s 1852KB
stdin
Standard input is empty
stdout
1001000110010001101010111010010010011100


40