public byte[] ComputeUserPassword(byte[] ownerPassword)
{
byte[] userPad = ComputeOwnerKey(ownerKey, PadPassword(ownerPassword));
for (int i = 0; i < userPad.Length; i++) {
bool match = true;
for (int j = 0; j < userPad.Length - i; j++) {
if (userPad[i + j] != pad[j]) {
match = false;
break;
}
}
if (!match) continue;
byte[] userPassword = new byte[i];
System.Array.Copy(userPad, 0, userPassword, 0, i);
return userPassword;
}
return userPad;
}