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

谁说我不能喝 提交于 2021-02-18 10:59:45

问题


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.


回答1:


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.




回答2:


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).



来源:https://stackoverflow.com/questions/14139684/is-md5-guaranteed-to-be-available-for-use-with-messagedigest-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!