Skydiver
Staff member
I was referring to this bit of code: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.
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];
}
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];