• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Regarding checksum calculation

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi in my project we are calculating the checksum using MD5 algorithm.The problem is the order of updation of the message digest is changing with this I am getting the different checksum for the same data.Is there any way to get same checksum irrespective of order of addition to the message digest.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are getting different checksums, SOMETHING is different - either in the data or the way you are doing the checksums.

What do you mean about "the order of updation of the message digest"? You can't expect MD5 to give the same result with different order of data items - only the simplest checksum algorithms would do that.

I suppose you could calculate a message digest for each independent data item and find a way to combine them that does not depend on the order.

Bill
 
author
Posts: 23928
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

You can't expect MD5 to give the same result with different order of data items - only the simplest checksum algorithms would do that.



A *checksum* algorithm will actually do that -- meaning take the sum and check it. Add all the characters together to form the checksum. This algorithm will not care about order since addition doesn't care about order.

Henry
 
Catch Ernie! Catch the egg! And catch this tiny ad too:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic