Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/380.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Serpent GCM bouncy castle在Android上的实现非常缓慢_Java_Android_Performance_Bouncycastle_Spongycastle - Fatal编程技术网

Java Serpent GCM bouncy castle在Android上的实现非常缓慢

Java Serpent GCM bouncy castle在Android上的实现非常缓慢,java,android,performance,bouncycastle,spongycastle,Java,Android,Performance,Bouncycastle,Spongycastle,我使用最新的源代码实现了Serpent GCM加密 public byte[] encrypt(byte[] key, byte[] iv, byte[] pt, byte[] aad, int tagLength) throws InvalidCipherTextException { GCMBlockCipher c = new GCMBlockCipher(new SerpentEngine()); c.init(true, new

我使用最新的源代码实现了Serpent GCM加密

public byte[] encrypt(byte[] key, byte[] iv, byte[] pt, byte[] aad,
        int tagLength) throws InvalidCipherTextException {
    GCMBlockCipher c = new GCMBlockCipher(new SerpentEngine());
    c.init(true,
            new AEADParameters(new KeyParameter(key), tagLength, iv, aad));
    int outsize = c.getOutputSize(pt.length);
    byte[] out = new byte[outsize];
    int len = c.processBytes(pt, 0, pt.length, out, 0);
    c.doFinal(out, len);
    return out;
}
它在我的台式机(WindowsCoreI7)上运行得非常好。加密5Mb文件大约需要190毫秒。但突然间,部署在三星galaxy 4平板电脑(Android 5.0.1)上的相同代码需要40秒才能对同一文件进行相同的加密。我们尝试了华为Acend G300(Android 2.3.6),只需17秒

我们还测试了相同的加密,不幸的是,我们没有获得更好的性能

  • 你能告诉我为什么它与台式机有如此显著的不同,为什么华为的加密时间要比三星galaxy s4平板电脑快得多
  • 是否有任何方法可以提高Android上代码的性能

  • 非常感谢您的帮助

    你试过跟踪吗?@zapl还没有,我们会尽快尝试。你试过跟踪吗?@zapl还没有,我们会尽快尝试