Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is MD5 guaranteed to be available for use with MessageDigest in Android?

I want to know if the MD5 digest algorithm is guaranteed to be available in all Android devices before I bluntly ignore the checked exception that MessageDigest.getInstance("MD5") can throw.

like image 688
Daniel Avatar asked Jan 03 '13 13:01

Daniel


2 Answers

I'm getting java.security.NoSuchAlgorithmException: MessageDigest MD5 implementation not found on some devices. Here's the list:

GT-I8190
GT-I9100
GT-P3100
GT-S7562
HTC EVO 3D X515m
HTC Sensation 4G
HTC Sensation XL with Beats Audio X315b
LGL86C
LT22i
LT25i
LT26i
LT26ii
LT29i
SAMSUNG-SGH-I727
SGH-T769
SHV-E160K
SM-T211
ST21i
ST23i
ST26i
T7

and others.

This is statistics mainly for Indonesia though. The funny point is, the statistics is provided by Crittercism, and the exception is thrown by Crittercism too (looks like it uses MD5 in latest versions).

like image 184
ernazm Avatar answered Sep 21 '22 09:09

ernazm


The Android JCE (Java Cryptography Extension) is based off the bouncycastle implementation but stripped down. bouncycastle provides a ton of different MessageDigests which can be found here.

There's no guarantee that every Android device supports MD5 but it's extremely common and is likely to be on every device as it's supported in bouncycastle. If you want to know if the device supports MD5 you can check the algorithms the device supports. More on that is here.

like image 33
Michael Celey Avatar answered Sep 18 '22 09:09

Michael Celey