3 Replies Latest reply on May 28, 2013 3:46 PM by mmatloka

    Hash of Archive

    smikloso

      Hi

       

      I have a file (apk file to be precise). I make a hash of this file by some technique. Then I create a JavaArchive via good old Shrinkwrap.createFromZipFile(). Now, I have the Archive<?>. The question is, if I do not do any modifications at all and I write this Archive directly to some other file with

       

      archive.as(ZipExporter.class).exportAsInputStream();

       

      will have this copy of the original file exactly the same hash? Can I take this as a fact I can rely on?

       

      Thanks

        • 1. Re: Hash of Archive
          mmatloka

          Hi,

          File exported via ZipExporter should be the same as the original file imported via createFromZipFile(). Some our internal tests are basing on this rule. If for some case they would not be, then it would be a bug.

          • 2. Re: Hash of Archive
            aslak

            I would say this highly depend on how the original Zip was created.

             

            Which compression level was used?

            Were empty directories stored?

            While it maintain the same 'Files', are they exported in the same order as in the original?

            • 3. Re: Hash of Archive
              mmatloka

              Right, sorry, I've forgotten about those things, and our tests uses export as file rather than as input stream. From shrinkwrap side it uses currently deflate compression by default. Probably the best choice for you would be to test this in practice with your apks.