Arduino code equivalent for python code binascii.unhexlify command

I want to convert ahexadecimal string to binary data.
For example, if i have a string like '424D368403', my output should be like b'BM6\x84\x03'.
The python code binascii.unhexlify('424D368403') gives the correct output.
But, I want to do this in arduino code.
Can someone help me in creating an arduino code / command in getting desired output?

What have you tried? What results has google shown you? I quick search will give you the answer.

If i understand the request, you want to convert the hex representation (2 hex chars per byte) of binary data bytes back to data bytes

So, for the hex string

you want a 5 bytes array
byte myData = {0x42, 0x4D, 0x36, 0x84, 3};

If that is the case, you can use my function

bool hexToBin(const char *hexStr, byte *binBuf, const int binBufLen);

For example

byte myData[5];

hexToBin("424D368403", myData, 5);

Here is the code

// add the value of an hex digit to res
// if the supposed hexDigit is not an hex digit, return false
bool addHexDigitToInt(const char hexDigit, int *res)
  if (isdigit(hexDigit))  
    *res += (hexDigit - '0');
    return true;

  if (!isxdigit(hexDigit))
    return false;

  const char base = isupper(hexDigit) ? 'A' : 'a';
  *res += (hexDigit - base) + 10;
  return true;  

// convert two hex digits to an integer
// if one (or both) chars are not hex digits, return -1
int twoHexDigitToInt(const char *pHex)
  int res = 0;
  if (!addHexDigitToInt(*pHex, &res))
    return -1;

  res <<= 4;

  if (addHexDigitToInt(*(pHex + 1), &res))
    return res;

  return -1;

// convert the hex representation of a byte array back to a byte array
// parameters
//  hexStr = [input] hex string, must contain only hex digit (['0'-'9']['a'-'f']['A'-'F']), two hex digit per output byte
//  binBuf = [output] buffer for binary data
//  binBufLen = [input] len of binBuf in bytes, must be >= strlen(hexStr)/2
// return
//   true if conversion was successfull, false otherwise
bool hexToBin(const char *hexStr, byte *binBuf, const int binBufLen)
  int hexLen = strlen(hexStr);

  if (hexLen % 2)
    // the input string contains an odd number of hex chars
    return false;

  if (binBufLen < hexLen/2)
    // the output buffer can't store all the data
    return false;

  const char *pHex = hexStr;
  byte *pBuf = binBuf;
  for (int i=0; i < hexLen; i+=2)
    int nextVal = twoHexDigitToInt(pHex+i);

    if (nextVal < 0)
      return false;

    *pBuf = (byte)nextVal;  

  return true;

why not just use strtol() rather than reinvent the wheel?