i am try to compare the Stored-password and Salted Password for the Experiment. Now i have a Stored Password and Salted-password., Stored-password having 72-byte and Salted-password having 18-bytes only, but i facing problem on comparison, how can i compare the both of them.. Here my Code :
RandomAccessFile raf = new RandomAccessFile(fileName, "r");
final byte[] stored = new byte[(int) raf.length()];
// in File : "9F3F4E45C0B58B410333D5CB45EB94B708285E80E77F85E1545B9CED25044EAF9158EADB";
String saltedPw="2013527f8d155ecf0";
byte[] saltedPassword=bc.getBytes();
byte[] sha1 = MessageDigest.getInstance("SHA-1").digest(saltedPw);
byte[] md5 = MessageDigest.getInstance("MD5").digest(saltedPw);
byte[] hashed=(toHex(sha1)+toHex(md5)).getBytes();
Arrays.equals(hashed, stored); // its mismatching here
I compared both of them but its mismatching. what is the problem on that.. how can i get the Pin-number.. Anyone help me...
Thanks in Advance.. :)