diff --git a/src/types.jl b/src/types.jl index 7270425..7ecd414 100644 --- a/src/types.jl +++ b/src/types.jl @@ -58,20 +58,6 @@ mutable struct SHA2_512_256_CTX <: SHA2_CTX used::Bool end -function Base.getproperty(ctx::SHA2_CTX, fieldname::Symbol) - if fieldname === :state - return getfield(ctx, :state)::Union{Vector{UInt32},Vector{UInt64}} - elseif fieldname === :bytecount - return getfield(ctx, :bytecount)::Union{UInt64,UInt128} - elseif fieldname === :buffer - return getfield(ctx, :buffer)::Vector{UInt8} - elseif fieldname === :used - return getfield(ctx, :used)::Bool - else - error("type ", typeof(ctx), " has no field ", fieldname) - end -end - # Typealias common nicknames for SHA2 family of functions const SHA224_CTX = SHA2_224_CTX @@ -111,22 +97,6 @@ mutable struct SHA3_512_CTX <: SHA3_CTX used::Bool end -function Base.getproperty(ctx::SHA3_CTX, fieldname::Symbol) - if fieldname === :state - return getfield(ctx, :state)::Vector{UInt64} - elseif fieldname === :bytecount - return getfield(ctx, :bytecount)::UInt128 - elseif fieldname === :buffer - return getfield(ctx, :buffer)::Vector{UInt8} - elseif fieldname === :bc - return getfield(ctx, :bc)::Vector{UInt64} - elseif fieldname === :used - return getfield(ctx, :used)::Bool - else - error("type ", typeof(ctx), " has no field ", fieldname) - end -end - # Define constants via functions so as not to bloat context objects. Yay dispatch! # Digest lengths for SHA1, SHA2 and SHA3. This is easy to figure out from the typename