Base64 To Hex Convertor Source Code For Custom JS Codec

Hi,

Does anyone have source code for a base64 to hex convertor they can share that works with the Chirpstack Application Server (not everything I have tried so far will run or give correct results)?

Thanks guys,

Mark

1 Like

Hello, i’m using https://cryptii.com/ for this. works.

1 Like

Thanks for that, however, I was after source code to include in a codec…Mark

Hello, the output of custom j’s codec is hex format,
for example :

return {
“timeBetween”: ((bytes[0] & 0x0F) << 4) +(bytes[1] >> 4) ,
“nbreValeur”: ((bytes[1] & 0x0F) << 4) + (bytes[2] >> 4) ,
“batterie”: ((bytes[2] & 0x0F) << 4) + (bytes[3] >> 4) ,
“minWind”: (((bytes[3] & 0x0F) << 8) + ((bytes[4] >> 4) << 4) + (bytes[4] & 0x0F))/10 ,
“avgWind”: (((bytes[5] >> 4) << 8) + ((bytes[5] & 0x0F) << 4) + (bytes[6] >> 4))/10,
“maxWind”: (((bytes[6] & 0x0F) << 8) + ((bytes[7] >> 4) << 4) + (bytes[7] & 0x0F))/10 ,
“temp1”: ((bytes[8] << 8) + (bytes[9]))/100 - 40,
“temp2”: ((bytes[10] << 8) + (bytes[11]))/100 - 40,
“hum”: ((bytes[12] << 4) + (bytes[13] >> 4))/10,
“pression”: (((bytes[13] & 0x0F) << 12) + (bytes[14] << 4) + (bytes[15] >> 4)) + 50000,
“girouette”: (bytes[15] & 0x0F),
“pluvioCur”: ((bytes[16] << 8) + (bytes[17]))/100,
“pluvioLast”: ((bytes[18] << 8) + (bytes[19]))/100,
“pluvio24h”: ((bytes[20] << 8) + (bytes[21]))/100,

    };

Thanks ever so much.