JuliaCrypto / MD5.jl

A performant, 100% native-julia MD5 implementation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

copy(::MD5_CTX) throws error

BonelessPi opened this issue · comments

Here's my example:

julia> using MD5

julia> ctx = MD5.MD5_CTX()
MD5 hash state

julia> copy(ctx)
ERROR: MethodError: no method matching MD5.MD5_CTX(::Vector{UInt32}, ::UInt64, ::Vector{UInt8})
Closest candidates are:
  MD5.MD5_CTX(::Vector{UInt32}, ::UInt64, ::Vector{UInt8}, ::Bool)

Seems to have originated due to the new "used" field in MD5_CTX. The Base.copy method in types.jl was not updated after the change.

Should Base.copy even attempt to copy internal fields of the object? The documentation says that Base.copy is a shallow copy while Base.deepcopy is recursive. I personally think that the line should be removed and people can use the default deepcopy implementation instead as that would be more consistent with the standard library