# Decrypt LoRa packet

**URL:** <https://discourse.nodered.org/t/decrypt-lora-packet/79046>\
**Category:** General\
**Created:** [8 June 2023 06:55 UTC](https://discourse.nodered.org/t/decrypt-lora-packet/79046 "2023-06-08T06:55:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NEX](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@NEX](https://discourse.nodered.org/u/NEX)\
**Post date:** [8 June 2023 06:55 UTC](https://discourse.nodered.org/t/decrypt-lora-packet/79046/1 "2023-06-08T06:55:47Z")

</div>

Hi for all  
I'm a newbie to node red , I'm trying to receive and send a LoRa packet to my server. I put a TCPin to listen on a port and I get a similar packet as string

01879004:ffffffcf0000005a10020100;

or as buffer

48,49,56,55,57,48,48,52,58,102,102,102,102,102,102,99,49,48,48,48,48,48,48,53,50,49,48,48,54,48,49, 48,48,59,13,10

i would like to fetch some data to put into my my sql and fetch data from my db to send it to the end node.

I receive the packet in TCPin , I have already implemented the writing and reading in mysql but I can't decipher this data.

I tried contrib nodes but they don't work.

Has anyone faced a similar problem before?

Regards

NEX

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [8 June 2023 12:50 UTC](https://discourse.nodered.org/t/decrypt-lora-packet/79046/2 "2023-06-08T12:50:29Z")

</div>

Hi, normally your message is encoded in Hexadecimal, so you have to convert Hex to String:

```auto
const buffer = Buffer.from(msg.payload, "hex");
const data = buffer.toString("base64");
return { payload: data };

```

---

<div class="post-metadata">

**Author:** ![NEX](https://avatars.discourse-cdn.com/v4/letter/n/e47c2d/32.png) [@NEX](https://discourse.nodered.org/u/NEX)\
**Post date:** [8 June 2023 14:15 UTC](https://discourse.nodered.org/t/decrypt-lora-packet/79046/3 "2023-06-08T14:15:14Z")

</div>

thanks a lot

I test your code at soon possible

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 August 2023 14:16 UTC](https://discourse.nodered.org/t/decrypt-lora-packet/79046/4 "2023-08-07T14:16:04Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
