Slow AES GCM encryption and decryption with Java 8u20

后端 未结 3 1783
迷失自我
迷失自我 2020-11-30 06:25

I am trying to encrypt and decrypt data using AES/GCM/NoPadding. I installed the JCE Unlimited Strength Policy Files and ran the (simple minded) benchmark below. I\'ve done

3条回答
  •  無奈伤痛
    2020-11-30 07:05

    The OpenSSL implementation is optimized by the assembly routine using pclmulqdq instruction(x86 platform). It very fast due to the paralleled algorithm.

    The java implementation is slow. but it was also optimized in Hotspot using assembly routine(not paralleled). you have to warm up the jvm to use Hotspot intrinsic. The default value of -XX:CompileThreshold is 10000.

    // pseudocode

    warmUp_GCM_cipher_loop10000_times();

    do_benchmark();

提交回复
热议问题