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

MD5 stopped working for Julia 1.11 #11

Closed
bensetterholm opened this issue Oct 3, 2023 · 9 comments · Fixed by #12
Closed

MD5 stopped working for Julia 1.11 #11

bensetterholm opened this issue Oct 3, 2023 · 9 comments · Fixed by #12

Comments

@bensetterholm
Copy link

Somewhere between Julia 1.11.0-DEV.550 (working) and 1.11.0-DEV.555 (failing), based on when my unit test reports making use of MD5 checksums started failing, something seems to have broken.

I'm not sure how to begin debugging this problem, or whether it would be better to file the issue in the SHA.jl repo or the the main julialang repo. The stack trace does not make much sense to me, and none of the referred to lines seem to have been touched in a long time.

Current "nightly" output (Julia 1.11.0-DEV.590)

julia> md5("test")
ERROR: type MD5_CTX has no field used
Stacktrace:
[1] getproperty
   @ Base ./Base.jl:37 [inlined]
[2] update!(context::MD5.MD5_CTX, data::Base.CodeUnits{UInt8, String}, datalen::Int64)
   @ SHA /Applications/[Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/SHA/src/common.jl:20](http://julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/SHA/src/common.jl:20)
[3] update!(context::MD5.MD5_CTX, data::Base.CodeUnits{UInt8, String})
   @ SHA /Applications/[Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/SHA/src/common.jl:20](http://julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/SHA/src/common.jl:20)
[4] md5(data::Base.CodeUnits{UInt8, String})
   @ MD5 ~/.julia/packages/MD5/H5Cdd/src/MD5.jl:18
[5] md5(str::String)
   @ MD5 ~/.julia/packages/MD5/H5Cdd/src/MD5.jl:24
[6] top-level scope
   @ REPL[7]:1

Expected output (Julia 1.9.3)

julia> md5("test")
16-element reinterpret(UInt8, ::Vector{UInt32}):
0x09
0x8f
0x6b
0xcd
0x46
0x21
0xd3
0x73
0xca
0xde
0x4e
0x83
0x26
0x27
0xb4
0xf6
@jw3126
Copy link
Collaborator

jw3126 commented Oct 4, 2023

Thanks for reporting. Does SHA.jl work nightly, can you check?

@bensetterholm
Copy link
Author

@jw3126 - my apologies for the delayed reply. As far as I can tell, SHA,jl is functioning normally on the most recent nightly build (1.11.0-DEV.643). All I tried was the example in the repo's readme, namely:

julia> sha256("test")
32-element Vector{UInt8}:
 0x9f
 0x86
 0xd0
 0x81
 0x88
    ⋮
 0x15
 0xb0
 0xf0
 0x0a
 0x08

The output is the same as under Julia v1.9.3. I also tested MD5 today under the current nightly build and the error is still the same as reported last week, so it seems that only MD5 is affected.

If you would like me to run a different test, please let me know.

@bensetterholm
Copy link
Author

I also just ran the package unit tests for the two packages under the current nightly build. SHA.jl passes all of its unit tests whereas MD5.jl fails its tests with the same error as previously reported.

@jw3126
Copy link
Collaborator

jw3126 commented Oct 12, 2023

Ok since both package were not touched for a long time, maybe report as a julia bug?

@jw3126
Copy link
Collaborator

jw3126 commented Oct 12, 2023

does MD5 pass on v1.9? Maybe there was a breaking change 4 months ago in SHA https://github.com/JuliaCrypto/SHA.jl/blame/e1af7dd0863dee14a83550faf4b6e08971993ce8/src/common.jl#L20 ?

@bensetterholm
Copy link
Author

@jw3126 - Yes, tests pass for Julia 1.9.3 on my machine, as well as as for 1.10.0-beta3.

@nsajko
Copy link

nsajko commented Oct 12, 2023

Yeah, that change in SHA added the used field: JuliaCrypto/SHA.jl@5e3a676

So this is an incompatibility between SHA.jl and MD5.jl

@jw3126
Copy link
Collaborator

jw3126 commented Oct 13, 2023

@jakobnissen any chance you could also apply your SHA.jl change JuliaCrypto/SHA.jl@5e3a676 here?

@jw3126
Copy link
Collaborator

jw3126 commented Oct 13, 2023

@jw3126 - Yes, tests pass for Julia 1.9.3 on my machine, as well as as for 1.10.0-beta3.

this puzzles me, did you use the same SHA.jl versions?

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

Successfully merging a pull request may close this issue.

3 participants