且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

AES256加密/解密速度

更新时间:2023-02-17 18:24:56

有很多在这里的贴子#2抱怨慢I / Android上的O操作。很多时候,问题是一个坏块大小为执行日写操作。

There are a lot of postings here on *** complaining about slow I/O operations on Android. Very often the problem is a bad block-size for performing th write operations.

在智能手机中使用闪存组织了几千字节的大块 - 因此***写入速度,你应该只写它的4KB块或多个

Flash memory as used in Smartphones is organized in large blocks of several kilobytes - therefore for optimal write speed you should only write blocks of 4KB or multiple of it.

这是8字节的块加密算法AES一样工作逐块 - 这可能会导致大量的性能消耗

Ciphers like AES work block-wise on blocks of 8 bytes - this may lead to massive performance drain.

我建议通过的BufferedOutputStream 4或16KB的缓冲器大小发送CipherOutputStream的输出。这应该显著加快行动的过程。

I would recommend to send the output of the CipherOutputStream through a BufferedOutputStream with a buffer size of 4 or 16 KB. This should significantly speed-up the process.

此外,你必须考虑写入到闪存总是比读书更慢。

Additionally you have to consider that writing to flash memory is always slower than reading.