The method HashAlgorithm.TransformBlock
takes the arguments outputBuffer
and outputOffset
.
I can't think of a reason for this method to have those. Is it so common to copy the hashed data somewhere that the copy was made an integral part of this method?
I'm rather curious to see a good use case involving these output parameters.
It's pretty clearly an oversight. I couldn't find a source to back this up, but as it stands any use case we could imagine (I can't imagine any practical use cases) saves developers at most one line of code. Worse, any developer who (for whatever reason) did want a copy of his own buffer made would probably find it so unlikely that TransformBlock
would do this for her that she'd probably write that line of code herself anyway!
outputBuffer
is used by other ICryptoTransforms
in sensible ways (eg. as an output buffer), so it really should contain - when not null and not overwriting the input buffer - the intermediate digest, especially since it's not otherwise available from the class. (Making the intermediate digest available is a nice idea whenever the input to the algorithm appears in multiple contexts.)
My guess is:
inputBuffer
instead of this.HashValue
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With