SHARE
TWEET

Untitled

a guest Jun 15th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. unsigned char* hexstr_to_char(const char* hexstr)
  2. {
  3.     size_t len = strlen(hexstr);
  4.     if(len % 2 != 0)
  5.         return NULL;
  6.     size_t final_len = len / 2;
  7.     unsigned char* chrs = (unsigned char*)malloc((final_len+1) * sizeof(*chrs));
  8.     for (size_t i=0, j=0; j<final_len; i+=2, j++)
  9.         chrs[j] = (hexstr[i] % 32 + 9) % 25 * 16 + (hexstr[i+1] % 32 + 9) % 25;
  10.     chrs[final_len] = '\0';
  11.     return chrs;
  12. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top