When I encrypt something in md5 with java, it removes all the 0s from the hash, which isn't ok for me because it doesn't work with php, since php doesn't remove the 0s. Is there any way to fix it(other than making php remove 0s too). Here's my java code:
public String getMd5Hash(String str) {
try {
byte[] array = MessageDigest.getInstance("MD5").digest(str.getBytes());
StringBuffer sb = new StringBuffer();
for (int i = 0; i < array.length; ++i) {
sb.append(Integer.toHexString((array[i] & 0xFF) | 0x100).substring(1,3));
}
return sb.toString();
} catch (NoSuchAlgorithmException e) {
throw new IllegalStateException("Something went really wrong.");
}
return null;
}