AES acceleration for Java

后端 未结 6 1508
遥遥无期
遥遥无期 2020-12-03 10:47

I want to encrypt/decrypt lots of small (2-10kB) pieces of data. The performance is ok for now: On a Core2Duo, I get about 90 MBytes/s AES256 (when using 2 threads). But I m

6条回答
  •  悲哀的现实
    2020-12-03 11:13

    Usually the step which consumes more time is Initiating the KeyGenerator.

    KeyGenerator keyGen = KeyGenerator.getInstance("AES");
    keyGen.init(256); // This step takes more time
    KeyGenerator aesKey = keyGen.generateKey();
    

    The way I solved it is by generating a pool of KeyGenerator instances before the server statup and reusing them for just for Key Generation

提交回复
热议问题