Results 1 to 2 of 2

Thread: Need to calculate checksum, how can I do it?

  1. #1
    Join Date
    Jan 2018
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Need to calculate checksum, how can I do it?

    Hellow guys,
    I am doing a programm using QT. I have a intelHex file(.mcs) which stores bunch of lines with Hex type data. For now my programm reads 1st line of the file, parsing(if i correct) this and store into an QbyteArray object.
    For example 1st line of the file is :":020000040010EA" and after compilation in my QbyteArray object i have this :"\x02\x00\x00\x04\x00\x10\xEA".
    What my teacher said thats right. Now I need to calculet checksum for this bytes and send a message.
    If it would help to understand what i need there is a python code what I am trying to do

    Qt Code:
    1. if (sum(bytes) & 0xFF) != 0:
    2. print('Bad checksum!')
    3. raise StopIteration
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Need to calculate checksum, how can I do it?

    f it would help to understand what i need
    And it would help if you explained what the actual question is.
    is the sum() function in your code implemented or do you need to implement it and don't know how?
    If it is implemented - I don't understand what you need.
    If you can explain a bit more about the problem you have it wold help us to help you.
    If the problem is how to implement a checksum, google and wikipedia are a good place to start there is a lot information available on the internet about checksum calculation, and various types of checksum algorithms.
    You can ask here any specific questions you need help with if you are stuck.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

Similar Threads

  1. hex from Qlineedit and checksum
    By hovuquocan1997 in forum Qt Programming
    Replies: 2
    Last Post: 15th July 2015, 22:58
  2. Qt CRC64 Checksum
    By alrawab in forum Newbie
    Replies: 1
    Last Post: 20th January 2013, 02:08
  3. crc checksum
    By kodiak in forum Qt Programming
    Replies: 1
    Last Post: 19th April 2008, 10:27
  4. checksum routines?
    By gfunk in forum Qt Programming
    Replies: 2
    Last Post: 20th September 2007, 01:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.