AES decryption on Android too slow to be usable. Will NDK be faster? Other ideas?

后端 未结 1 948
-上瘾入骨i
-上瘾入骨i 2020-12-06 13:21

I\'ve implemented AES/CTR on Android using the built-in Cipher class. Decryption appears to be far too slow for my purposes, with a 128KB block taking approximately 6 secon

相关标签:
1条回答
  • 2020-12-06 13:25

    Yes, heavy lifting like that in a contained function is exactly where the NDK would shine. Keep in mind that Java is interpreted, and on pre-2.2 Android, there is no JIT, so every instruction is interpreted each time - that is a huge overhead.

    Even with JIT, every array access does implicit bounds checking, so there is lots and lots of overhead.

    If you write this function in C++, it will be significantly faster.

    0 讨论(0)
提交回复
热议问题