@@ -51,21 +51,25 @@ mutable struct SHA3_224_CTX <: SHA3_CTX
5151 state:: Array{UInt64,1}
5252 bytecount:: UInt128
5353 buffer:: Array{UInt8,1}
54+ bc:: Array{UInt64,1}
5455end
5556mutable struct SHA3_256_CTX <: SHA3_CTX
5657 state:: Array{UInt64,1}
5758 bytecount:: UInt128
5859 buffer:: Array{UInt8,1}
60+ bc:: Array{UInt64,1}
5961end
6062mutable struct SHA3_384_CTX <: SHA3_CTX
6163 state:: Array{UInt64,1}
6264 bytecount:: UInt128
6365 buffer:: Array{UInt8,1}
66+ bc:: Array{UInt64,1}
6467end
6568mutable struct SHA3_512_CTX <: SHA3_CTX
6669 state:: Array{UInt64,1}
6770 bytecount:: UInt128
6871 buffer:: Array{UInt8,1}
72+ bc:: Array{UInt64,1}
6973end
7074
7175# Define constants via functions so as not to bloat context objects. Yay dispatch!
@@ -111,10 +115,10 @@ SHA2_256_CTX() = SHA2_256_CTX(copy(SHA2_256_initial_hash_value), 0, zeros(UInt8,
111115SHA2_384_CTX () = SHA2_384_CTX (copy (SHA2_384_initial_hash_value), 0 , zeros (UInt8, blocklen (SHA2_384_CTX)))
112116SHA2_512_CTX () = SHA2_512_CTX (copy (SHA2_512_initial_hash_value), 0 , zeros (UInt8, blocklen (SHA2_512_CTX)))
113117
114- SHA3_224_CTX () = SHA3_224_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_224_CTX)))
115- SHA3_256_CTX () = SHA3_256_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_256_CTX)))
116- SHA3_384_CTX () = SHA3_384_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_384_CTX)))
117- SHA3_512_CTX () = SHA3_512_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_512_CTX)))
118+ SHA3_224_CTX () = SHA3_224_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_224_CTX)), Vector {UInt64} ( 5 ) )
119+ SHA3_256_CTX () = SHA3_256_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_256_CTX)), Vector {UInt64} ( 5 ) )
120+ SHA3_384_CTX () = SHA3_384_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_384_CTX)), Vector {UInt64} ( 5 ) )
121+ SHA3_512_CTX () = SHA3_512_CTX (zeros (UInt64, 25 ), 0 , zeros (UInt8, blocklen (SHA3_512_CTX)), Vector {UInt64} ( 5 ) )
118122
119123# Nickname'd outer constructor methods for SHA2
120124const SHA224_CTX = SHA2_224_CTX
@@ -129,7 +133,7 @@ SHA1_CTX() = SHA1_CTX(copy(SHA1_initial_hash_value), 0, zeros(UInt8, blocklen(SH
129133# Copy functions
130134copy (ctx:: T ) where {T<: SHA1_CTX } = T (copy (ctx. state), ctx. bytecount, copy (ctx. buffer), copy (ctx. W))
131135copy (ctx:: T ) where {T<: SHA2_CTX } = T (copy (ctx. state), ctx. bytecount, copy (ctx. buffer))
132- copy (ctx:: T ) where {T<: SHA3_CTX } = T (copy (ctx. state), ctx. bytecount, copy (ctx. buffer))
136+ copy (ctx:: T ) where {T<: SHA3_CTX } = T (copy (ctx. state), ctx. bytecount, copy (ctx. buffer), Array {UInt64} ( 5 ) )
133137
134138
135139# Make printing these types a little friendlier
0 commit comments