I can generate md5 with this function :
private void generateMd5() throws NoSuchAlgorithmException, IOException {
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] hash = md.digest(pathFile.getBytes());
nomGestionnaire.setText(String.valueOf(String.format("%032X", new BigInteger(1, hash))));
}
My problem is when I compare my md5 generate with another md5 generator I don't have the same value. Is it normal ? It's like my generator doesn't generate a real md5 ?
Test with this file : aaa.txt (content : aaa)
My generator : A4FA953DB4BC7772E5AF67BD706B9110
other generator : 47bce5c74f589f4867dbd57e9ca9f808
EDIT :
FileChooser fileChooser = new FileChooser();
File selectedFile = new
File(String.valueOf(fileChooser.showOpenDialog(primaryStage)));
nameFile = selectedFile.getName();
pathFile = selectedFile.getPath();