 }
 
 
-uint8_t *CStringToUInt8(char *str, int &len)
+uint8_t *CStringToUInt8(char *str, uint8_t &len)
 {
     len = strlen(str);
     uint8_t *buf = new uint8_t[len];

}


uint8_t *HexToUInt8(char *hexStr, int &len)
{
    len = strlen(hexStr);
    uint8_t *buf = new uint8_t[len];

#include <MD5.h>

char *correct_key = "sharedkey";

void setup()
{
    Serial.begin(115200);
}

void loop()
{
    if (Serial.available() >= 3)
    {
        // Get user message
        uint32_t id = (uint32_t)Serial.parseInt();
        uint8_t dlc = (uint8_t)Serial.parseInt();
        uint8_t *msg = new uint8_t[dlc+1];
        for(int i = 0; i < dlc; i++)
            msg[i] = (uint8_t)Serial.parseInt();
        char *key = (char *)(Serial.readString().c_str());
        uint8_t msgLen, keyLen;
        SendAuthMessages(correct_key, keyLen, msg, msgLen);
        Serial.flush();
    }
}


void SendAuthMessages(char *key, uint8_t &keyLen, uint8_t *data, uint8_t &dataLen)
{
    // Convert to uint8_t
    uint8_t *theKey = CStringToUInt8(key, keyLen);
    uint8_t *theMessage = data;

    // Concatenate into one full message
    uint8_t *fullMessage = new uint8_t[keyLen + dataLen + 1];
