Android中的Java密码学标准库是否作为本机代码运行 [英] Is Java Cryptography standard libraries in Android run as native code
问题描述
我正在将标准Java密码学类集成到我的Android应用程序中,但是我注意到AES算法的速度不是很快,它每秒不能加密超过5 Kb,所以有人知道如果我能获得更高的性能,使用NDK实现我自己的加密方法?还是只是已经在标准库中完成了?任何建议表示赞赏
I am integrating standard java cryptography classes in my Android application, but I noticed that the AES algorithm is not that fast, it cannot encrypt more than about 5 Kb per second, so do someone know if I can get more performance if I implement my own cryptography methods using NDK? or it is just being done already in the standard library? any suggestions is appreciated
推荐答案
Android中的Java密码标准库是否作为本机代码运行
Is Java Cryptography standard libraries in Android run as native code
在较旧的设备上,javax.crypto
用Java代码实现.从Android 4.3或4.4开始,Android使用基于OpenSSL的javax.crypto
提供程序,因此大多数代码将是本机代码.
On older devices, javax.crypto
is implemented in Java code. Starting in Android 4.3 or 4.4, Android uses an OpenSSL-based javax.crypto
provider, so most of the code will be native.
那么有人知道如果我使用NDK实现自己的加密方法是否可以获得更高的性能?
so do someone know if I can get more performance if I implement my own cryptography methods using NDK?
如果用实施我自己的加密方法"来表示链接并使用libcrypto
",则在较旧的设备上可能会更快,但在较新的设备上不会有太大的区别.
If by "implement my own cryptography methods", you mean "link to and use libcrypto
", that may be faster on older devices, but I would not expect much difference on newer devices.
这篇关于Android中的Java密码学标准库是否作为本机代码运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!