6

I need to hash a password with salt in C#. Salt is obtained from one source and is of type byte[], password is obtained from another source and is of type String.

Computing a hash of one block is quite easy - just call HashAlgorithm.ComputeHash() and it's done, but how do I compute a hash of two blocks without first building their concatenation?

2 Answers 2

3

You'll want to look into the TransformBlock and TransformFinalBlock methods.

The latter MSDN link exemplifies use of both with a code sample that is potentially to much to post here.

Sign up to request clarification or add additional context in comments.

Comments

1

Use TransformBlock and TransformFinalBlock and then use the Hash property.

1 Comment

I'm confused about the outbutBuffer parameter to TransformBlock - why do we need to copy the data?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.