Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing hashes when switching JVM version #9

Closed
rutchkiwi opened this issue Dec 17, 2018 · 6 comments
Closed

Changing hashes when switching JVM version #9

rutchkiwi opened this issue Dec 17, 2018 · 6 comments

Comments

@rutchkiwi
Copy link

Hi! Thanks for writing this library!

I just upgraded my JVM version from java 1.8 to openjdk 11, and with that change the hashes generated by the digest/md5 function changed.

This creates a problem for me, as I use this library for generating hashes that are used to check uniqueness of images uploaded into a system. (by storing the generated hashed in a database)

Is this expected behaviour?

Thanks!

@tebeka
Copy link
Collaborator

tebeka commented Dec 17, 2018

Thanks @rutchkiwi ! I'm not aware of the changes to MD5 in JDK11, will investigate.

@rutchkiwi
Copy link
Author

Great, thank you! :) If it helps I'm hashing java.io.files and byte arrays - both their hashes changed.

@tebeka
Copy link
Collaborator

tebeka commented Dec 17, 2018

I don't see a difference:

JDK 11

root@12f28f5aef6b:/# ./lein repl
nREPL server started on port 46203 on host 127.0.0.1 - nrepl://127.0.0.1:46203
REPL-y 0.4.3, nREPL 0.5.3
Clojure 1.8.0
OpenJDK 64-Bit Server VM 11.0.1+13-Debian-3
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (load-file "digest.clj")
nil
user=> (digest/md5 "hello")
"5d41402abc4b2a76b9719d911017c592"

JDK 8

root@f88c0777af13:/# ./lein repl
nREPL server started on port 35125 on host 127.0.0.1 - nrepl://127.0.0.1:35125
REPL-y 0.4.3, nREPL 0.5.3
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_181-8u181-b13-2~deb9u1-b13
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=> (load-file "digest.clj")
nil
user=> (digest/md5 "hello")
"5d41402abc4b2a76b9719d911017c592"

@rutchkiwi
Copy link
Author

Hmm odd - I'll come back to you with a concrete test case in a bit.

@rutchkiwi
Copy link
Author

Hi @tebeka after looking into this a bit futher and trying to make a concrete test case, it seems that in fact my problem is not with this library 😬 but rather that something else in the JDK has changed (I'm hashing images after some processing - probably somewhere in this processing something changed).

I'm really sorry for wasting you time.

Thank you very much for the help, and for this library!

@tebeka
Copy link
Collaborator

tebeka commented Dec 17, 2018

No worries, thanks for using clj-digest and reporting problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants