Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to get md5 value or alike from arraylist?

How to get md5 value or alike from arraylist?

Scheduled Pinned Locked Moved C#
cryptographytutorialquestion
10 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lvq684
    wrote on last edited by
    #1

    Hi. I want to compare two arraylists with each other, but not with the compare method. That means, I have two computers with an arraylist on each of them. If the contents of these arraylists are the same, the calculated value from the arraylist should also be the same. So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever! :) Thanks alot :)

    L L 2 Replies Last reply
    0
    • L lvq684

      Hi. I want to compare two arraylists with each other, but not with the compare method. That means, I have two computers with an arraylist on each of them. If the contents of these arraylists are the same, the calculated value from the arraylist should also be the same. So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever! :) Thanks alot :)

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      lvq684 wrote:

      So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever!

      Not really; these values are used to check whether the original data has been changed or corrupted in any way. However, they are not universally unique, so if two sets of data generate the same hash code, that does not guarantee that their contents are identical. The only way to compare two sets is to compare each item within the set.

      L 1 Reply Last reply
      0
      • L Lost User

        lvq684 wrote:

        So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever!

        Not really; these values are used to check whether the original data has been changed or corrupted in any way. However, they are not universally unique, so if two sets of data generate the same hash code, that does not guarantee that their contents are identical. The only way to compare two sets is to compare each item within the set.

        L Offline
        L Offline
        lvq684
        wrote on last edited by
        #3

        Well the problem is that i am using .net remoting, and i gotta keep a clients arraylist updated. And it would be a waste of bandwith to send the arraylist as an object over to the server to compare it. Are there any easier way around this problem then? :|

        L X 2 Replies Last reply
        0
        • L lvq684

          Well the problem is that i am using .net remoting, and i gotta keep a clients arraylist updated. And it would be a waste of bandwith to send the arraylist as an object over to the server to compare it. Are there any easier way around this problem then? :|

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          lvq684 wrote:

          Are there any easier way around this problem then?

          Sorry, not that I know of. Does Google have any suggestions?

          L 1 Reply Last reply
          0
          • L Lost User

            lvq684 wrote:

            Are there any easier way around this problem then?

            Sorry, not that I know of. Does Google have any suggestions?

            L Offline
            L Offline
            lvq684
            wrote on last edited by
            #5

            Richard MacCutchan wrote:

            Sorry, not that I know of. Does Google have any suggestions?

            Ive been searching for quite some time now, but with no luck. Thought i might used the wrong keywords, so thats why i posted in here :)

            1 Reply Last reply
            0
            • L lvq684

              Hi. I want to compare two arraylists with each other, but not with the compare method. That means, I have two computers with an arraylist on each of them. If the contents of these arraylists are the same, the calculated value from the arraylist should also be the same. So is it possible to compare collections this way? MD5? Hash value? Checksum? Whatever! :) Thanks alot :)

              L Offline
              L Offline
              Luc Pattyn
              wrote on last edited by
              #6

              There is no general solution without comparing it all. Tell us more, there is bound to be a good solution for a specific case. What is the application? Is it only two arraylists? do they start off by being identical? how do they evolve? are things removed/modified/added? both sides? how frequent? :)

              Luc Pattyn


              I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


              Local announcement (Antwerp region): Lange Wapper? Neen!


              L 1 Reply Last reply
              0
              • L Luc Pattyn

                There is no general solution without comparing it all. Tell us more, there is bound to be a good solution for a specific case. What is the application? Is it only two arraylists? do they start off by being identical? how do they evolve? are things removed/modified/added? both sides? how frequent? :)

                Luc Pattyn


                I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                Local announcement (Antwerp region): Lange Wapper? Neen!


                L Offline
                L Offline
                lvq684
                wrote on last edited by
                #7

                Luc Pattyn wrote:

                Tell us more, there is bound to be a good solution for a specific case. What is the application? Is it only two arraylists? do they start off by being identical? how do they evolve? are things removed/modified/added? both sides? how frequent?

                The application is one server and many clients. The server will start off by sending the clients a copy of the newly created arraylist/collection. From time to time, the server will remove/add items (probably strings) from the arraylist, and the clients will afterwards have to fetch the updated arraylist (or the updates?). I am using remoting, so i can pass objects between client and server. But instead of sending the client´s arraylist to compare it (would be a large data transfer if the array is big), i would like to calculate some kind of value based on the list´s content, so i can pass that value to the server and compare it that way. Unless there are a better solution? The comparison would probably be once every 5 seconds on each client (around 40 clients). Thank you for your time! :)

                L 1 Reply Last reply
                0
                • L lvq684

                  Luc Pattyn wrote:

                  Tell us more, there is bound to be a good solution for a specific case. What is the application? Is it only two arraylists? do they start off by being identical? how do they evolve? are things removed/modified/added? both sides? how frequent?

                  The application is one server and many clients. The server will start off by sending the clients a copy of the newly created arraylist/collection. From time to time, the server will remove/add items (probably strings) from the arraylist, and the clients will afterwards have to fetch the updated arraylist (or the updates?). I am using remoting, so i can pass objects between client and server. But instead of sending the client´s arraylist to compare it (would be a large data transfer if the array is big), i would like to calculate some kind of value based on the list´s content, so i can pass that value to the server and compare it that way. Unless there are a better solution? The comparison would probably be once every 5 seconds on each client (around 40 clients). Thank you for your time! :)

                  L Offline
                  L Offline
                  Luc Pattyn
                  wrote on last edited by
                  #8

                  OK, so it seems to be a single producer multi-consumer situation. This is what I would do: - on the server create a class that holds the collection (ArrayList, generic List, whatever), and organizes a version number; every addition/removal/modification in the collection should increment the version number; that is why you need your own class, so nothing can change the collection without affecting the version number. - on each client, whenever relevant, ask the server for its version number and compare with the local version number; when different, go fetch the latest copy of the collection Possible refinement, depends on the frequency and multiplicity of the changes: - on the server, keep a list of changes to go from version N to N+1 - on the client, when the versions don't match, ask the differences from local version to official version, and apply them one by one. Alternative refinement: - split the collection in smaller collections, give them each a version number, and go fetch the smaller collection you need when it is outdated. :)

                  Luc Pattyn


                  I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                  Local announcement (Antwerp region): Lange Wapper? Neen!


                  L 1 Reply Last reply
                  0
                  • L lvq684

                    Well the problem is that i am using .net remoting, and i gotta keep a clients arraylist updated. And it would be a waste of bandwith to send the arraylist as an object over to the server to compare it. Are there any easier way around this problem then? :|

                    X Offline
                    X Offline
                    Xmen Real
                    wrote on last edited by
                    #9

                    Off Topic : As you mention 'bandwith' I assume that the server and clients are connected via internet. So, I'm just wondering that how your server working, do it needs to open a port ?

                    TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN% R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i’TV.C\y<pŠjxsg-b$f4ia>

                    ----------------------------------------------- 128 bit encrypted signature, crack if you can

                    1 Reply Last reply
                    0
                    • L Luc Pattyn

                      OK, so it seems to be a single producer multi-consumer situation. This is what I would do: - on the server create a class that holds the collection (ArrayList, generic List, whatever), and organizes a version number; every addition/removal/modification in the collection should increment the version number; that is why you need your own class, so nothing can change the collection without affecting the version number. - on each client, whenever relevant, ask the server for its version number and compare with the local version number; when different, go fetch the latest copy of the collection Possible refinement, depends on the frequency and multiplicity of the changes: - on the server, keep a list of changes to go from version N to N+1 - on the client, when the versions don't match, ask the differences from local version to official version, and apply them one by one. Alternative refinement: - split the collection in smaller collections, give them each a version number, and go fetch the smaller collection you need when it is outdated. :)

                      Luc Pattyn


                      I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages


                      Local announcement (Antwerp region): Lange Wapper? Neen!


                      L Offline
                      L Offline
                      lvq684
                      wrote on last edited by
                      #10

                      Thanks for the great reply. Versioning, of corse! Why the ... didnt i think of that to start with! Thanks alot Luc :)

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups