Giter Club home page Giter Club logo

Comments (6)

tony1tf avatar tony1tf commented on August 22, 2024

Another attempt with a new packet also gave the same error.
This is the packet 40 CE 18 01 26 80 00 00 01 6D BD C3 85 C1 2A A8 AF 90 A5 A8 82 96 3E DE 61 CB 5F C4
and my keys are: NwkSKey 4C28FD6ADA8A16A71EF854888B838BD8
AppSKey BEAFAB474374A9CD1EC524E7CBF0C25A

from lora-packet.

kartben avatar kartben commented on August 22, 2024

Can you be a bit more specific on where/how you're getting this error? Are you manipulating actual buffers, and not plain hex strings?

> const lora_packet = require("lora-packet");
undefined
> const packet = lora_packet.fromWire(Buffer.from("40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4","hex"))
undefined
> packet.MIC
<Buffer 61 cb 5f c4>
> const NwkSKey = Buffer.from("4C28FD6ADA8A16A71EF854888B838BD8", "hex")
undefined
> lora_packet.verifyMIC(packet, NwkSKey)
true
$ lora-packet-decode --nwkkey 4C28FD6ADA8A16A71EF854888B838BD8 --appkey BEAFAB474374A9CD1EC524E7CBF0C25A --hex 40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4  
decoding from Hex:  40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4
Decoded packet
--------------
Message Type = Data
            PHYPayload = 40CE180126800000016DBDC385C12AA8AF90A5A882963EDE61CB5FC4

          ( PHYPayload = MHDR[1] | MACPayload[..] | MIC[4] )
                  MHDR = 40
            MACPayload = CE180126800000016DBDC385C12AA8AF90A5A882963EDE
                   MIC = 61CB5FC4 (OK)

          ( MACPayload = FHDR | FPort | FRMPayload )
                  FHDR = CE180126800000
                 FPort = 01
            FRMPayload = 6DBDC385C12AA8AF90A5A882963EDE
             Plaintext = 0102025802880808D5FFD17D00208A ('...X.......}. .')

                ( FHDR = DevAddr[4] | FCtrl[1] | FCnt[2] | FOpts[0..15] )
               DevAddr = 260118CE (Big Endian)
                 FCtrl = 80
                  FCnt = 0000 (Big Endian)
                 FOpts =

          Message Type = Unconfirmed Data Up
             Direction = up
                  FCnt = 0
             FCtrl.ACK = false
             FCtrl.ADR = true

from lora-packet.

tony1tf avatar tony1tf commented on August 22, 2024

from lora-packet.

kartben avatar kartben commented on August 22, 2024

I also used the online decoder with your packet with no problem at all prior to posting my previous comment. Have you tried just removing the blanks in the hex string?

from lora-packet.

tony1tf avatar tony1tf commented on August 22, 2024

from lora-packet.

anthonykirby avatar anthonykirby commented on August 22, 2024

Hi @tony1tf,
glad that's sorted (and thank you to @kartben for the help!)
About the online decoder: I don't maintain this, it just uses lora-packet.
Anthony

from lora-packet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.