SharpHash - Full hashing library

As for the byte size being less than three. I think that was just me confusing bits and bytes. It should have been zero because one byte is eight bits and that is proper format.
I was referring to this bit of code:
C#:
// Double the size of the byte array to include the "pbkdf2.GetBytes" and salt.
var ByteNumber = salt.Length;
if (ByteNumber > 3)
{
    hashBytes = new byte[ByteNumber * 2];
}
what is hashBytes set to when ByteNumber <= 3. The reason why I was asking about ByteSize is because of this code: salt = new byte[ByteSize]
You could have change that code there to simply:
C#:
// Double the size of the byte array to include the "pbkdf2.GetBytes" and salt.
if (ByteSize > 3)
{
    hashBytes = new byte[ByteSize * 2];
}

Anyway, it looks like you resolved the issue in your new code in post #29:
C#:
// Double the size of the byte array to include the "pbkdf2.GetBytes" and salt.
Int32 g = hash.Length + salt.Length;
byte[] hashBytes = new byte[g];
 
Yep, changed the code and it looks and works a lot better. Now, with the dependency injection I think that's going to be in uphill battle for me with no SharpHash examples to build from and take part. I've been looking at a few YouTube's and seen some papers so far on dependency injection and it looks promising but, currently am not sure how to get all of the hash algorithms like "SHA2_SHA1ForPBKDF2()" in an interface so that it can be used or referred to. Actually, I'm only going to be using the SHA2 and SHA3.

So, now I will ask if you have some examples or can provide a code example using the interface (dependency injection) to get me started. This would be most helpful. Thanks.
 
Back
Top Bottom