-2

I want to calculate checksum of a string of hexadecimal values such as 040102 answer will 7 in this case and more complex as 0a0110000a3f800000 its answer will be AE.

I found an online link that gives me answer i want but i need to write code for same in python but not getting the output i want.

Please help Thank you in advance

  • 1
    Please share the code - see [ask]. – AcK Dec 29 '20 at 08:57
  • @ack currently i don't have any code i was looking for some reference. – Swapnil Gholap Dec 29 '20 at 09:17
  • Does this help [How do I calculate the MD5 checksum of a file in Python?](https://stackoverflow.com/questions/16874598/how-do-i-calculate-the-md5-checksum-of-a-file-in-python)? – itprorh66 Dec 29 '20 at 16:58
  • @itprorh66 in my case i have to just XOR the values – Swapnil Gholap Dec 30 '20 at 04:01
  • this site can help solve specific, technical problems, not open-ended requests. Please edit your question to show what you have tried so far. See the [How To Ask a Good Question](https://stackoverflow.com/help/how-to-ask "How To Ask a Good Question") and ["How do I ask and answer homework questions?"](https://meta.stackoverflow.com/questions/334822/how-do-i-ask-and-answer-homework-questions "How do I ask and answer homework questions?") pages for details on how to best help us help you. – itprorh66 Dec 30 '20 at 20:19

1 Answers1

0

I found the answer in which i can calculate checksum xor.

def HexToByte(hexStr):
    bytes = []
    hexStr = ''.join(hexStr.split(" "))
    for i in range(0, len(hexStr), 2):
        bytes.append(int(hexStr[i:i+2], 16))
    return bytes