ThexXTURBOXx / dex2jar

Tools to work with android .dex and java .class files
Apache License 2.0
234 stars 59 forks source link

Make output deterministic #32

Closed NebelNidas closed 1 year ago

NebelNidas commented 1 year ago

It would be nice if the generated JAR for a given input could be deterministic. Not sure if there are more hoops to go through, but my main complaint is that certain methods' auto-generated names seem to be changing each time you generate, like this one: $d2j$hex$c51fa2bb$decode_J

If you need a reproduction case, take any YouTube APK and search the given output JAR.

ThexXTURBOXx commented 1 year ago

That was a very good suggestion, actually. Thank you very much. It was a quick fix, but there is still a small problem: If you convert at least two dex files in a row when the JVM is still running, the second dex file will be rather non-deterministic again. In order to circumevent this, you can now control the used Random instance using the field Dex2jar#random and the methods Dex2jar#resetRandom and Dex2jar#setRandom.

NebelNidas commented 1 year ago

Thanks for the quick fix! :)

If you convert at least two dex files in a row when the JVM is still running, the second dex file will be rather non-deterministic again.

Good to know, as I'm actually doing that in my Gradle buildscript 👍