Converted MD5 hashing to bouncycastle implementation (to remove dependency on FastMD5)

This commit is contained in:
nathan 2016-03-07 03:02:18 +01:00
parent d040608763
commit 02ffddf1b6

View File

@ -16,11 +16,11 @@
package dorkbox.util.crypto; package dorkbox.util.crypto;
import com.twmacinta.util.MD5;
import dorkbox.util.OS; import dorkbox.util.OS;
import dorkbox.util.bytes.LittleEndian; import dorkbox.util.bytes.LittleEndian;
import org.bouncycastle.crypto.Digest; import org.bouncycastle.crypto.Digest;
import org.bouncycastle.crypto.PBEParametersGenerator; import org.bouncycastle.crypto.PBEParametersGenerator;
import org.bouncycastle.crypto.digests.MD5Digest;
import org.bouncycastle.crypto.digests.SHA1Digest; import org.bouncycastle.crypto.digests.SHA1Digest;
import org.bouncycastle.crypto.digests.SHA256Digest; import org.bouncycastle.crypto.digests.SHA256Digest;
import org.bouncycastle.crypto.digests.SHA512Digest; import org.bouncycastle.crypto.digests.SHA512Digest;
@ -81,12 +81,8 @@ class Crypto {
public static public static
byte[] hashFileMD5(File file) { byte[] hashFileMD5(File file) {
try { MD5Digest digest = new MD5Digest();
return MD5.getHash(file); return hashFile(file, digest, null);
} catch (IOException e) {
e.printStackTrace();
return null;
}
} }
public static public static