private byte[] PadPassword(byte[] userPassword)
{
byte[] userPad = new byte[32];
if (userPassword == null) {
Array.Copy(pad, 0, userPad, 0, 32);
}
else {
Array.Copy(userPassword, 0, userPad, 0, Math.Min(userPassword.Length, 32));
if (userPassword.Length < 32)
Array.Copy(pad, 0, userPad, userPassword.Length, 32 - userPassword.Length);
}
return userPad;
}