我試圖使用AES 128位密鑰解密一個4.2 MB的.dcf文件,但解密需要33秒(在函數cipher.doFinal(data)上),這是正常嗎?在Android中緩慢的AES解密
下面的代碼片段:
long start = System.currentTimeMillis()/1000L;
try {
SecretKeySpec skeySpec = new SecretKeySpec(key, "AES");
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivspec);
android.util.Log.d("TEST", "Start decoding...." + String.valueOf(length));
byte[] decrypted = cipher.doFinal(content);
File file2 = new File(Environment.getExternalStorageDirectory().getPath() + "/test.mp3");
OutputStream os = new FileOutputStream(file2);
os.write(decrypted);
} catch (Exception ex) {
ex.printStackTrace();
}
long end = System.currentTimeMillis()/1000L;
android.util.Log.d("TEST","Time "+ String.valueOf(end-start));
我希望這將取決於硬件? - 我的願望做某些事情比我的妻子的野火快了不少,例如你在上 – Squonk 2011-01-12 00:09:04
@MisterSquonk嘗試這個,我試過它在仿真器上花費了大約30-33秒,在我的三星Galaxy Spica上花費了大約25-30秒 – 2011-01-12 15:33:33