fork download
  1. #include <stdio.h>
  2.  
  3. static const unsigned char bin2ascii[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  4.  
  5. #define r64_get_1_byte( ucaf ) bin2ascii[ ( (ucaf)[0] >> 2 ) & 0x3f ]
  6. #define r64_get_2_byte( ucaf ) bin2ascii[ ( ( (ucaf)[0] << 4 ) & 0x30 ) | (( (ucaf)[1] >> 4 ) & 0x0f ) ]
  7.  
  8. int main(void) {
  9. char ucaf[50] = "90039D2152A9D9E1279E00642B0C78E584011E7D29";
  10. char ucaf1 = r64_get_1_byte( ucaf );
  11. char ucaf2 = r64_get_2_byte( ucaf );
  12. printf("%c-%c", ucaf1, ucaf2);
  13. return 0;
  14. }
  15.  
Success #stdin #stdout 0s 5280KB
stdin
Standard input is empty
stdout
O-T