Monday, November 5, 2018

Message Digest Performance

If I use the dependency groupId=commons-codec artifactId=commons-codec I get a huge performance hit on the method:

sun.security.provider.MD5.implCompress(byte[], int)


the code is:


import org.apache.commons.codec.digest.DigestUtils;
import java.io.File;
import java.io.FileInputStream;

FileInputStream fis = new FileInputStream(file);
String md5 = DigestUtils.md5Hex(fis);
fis.close();


If I use sha2 https://www.baeldung.com/sha-256-hashing-java



No comments: