I haven't been able to debug this issue yet. I was just wondering if someone already knew what this might be. Maybe some kind of character set issue?
A couple Japanese End Users are failing my one-way hash password protected application even though they are entering the same English password as everyone else.
The code looks like this:
char[] passwordAttempt = edtPassword.getPassword();
byte[] digest = new byte[0];
try {
MessageDigest algorithm = MessageDigest.getInstance("SHA-1");
algorithm.reset();
byte[] bytes = new byte[passwordAttempt.length];
for (int j = 0; j < passwordAttempt.length; j++) {
bytes[j] = (byte)passwordAttempt[j];
}
algorithm.update(bytes);
digest = algorithm.digest();
} catch (NoSuchAlgorithmException nsae) {
Trace.ex(nsae);
}
passwordValid = true;
if(digest.length != password.length) {
passwordValid = false;
}
else {
for(int i = 0; i < digest.length; i++) {
if (digest[i] != password) {
passwordValid = false;
break;
}
}
}
This code works fine on all the English-based pc's. I do know that no exceptions are being thrown.
Any suggestions?