How compute elapsed time encrypt and decrypt algorithm?

This question already has an answer here:

  • How do I write a correct micro-benchmark in Java? 11 answers

  • First of all, your encrypt and decrypt methods are obviously not correct for any serious security.

    The encryption method also seems to contain the generation of a random BigInteger. Normally you would only do this when generating a key pair (and then you would generate a prime, not any random integer, at least for the RSA algorithm). So what kind of encryption/decryption method this is is beyond me.

    Furthermore, it takes a long time for the Java VM to optimize. So basically you are best off using a very high number of testing rounds, then divide the elapsed time with the number of rounds.

    Your current output very much hinges on the state of the random number generator. If the entropy is depleted, it will take a long time for it to generate new numbers.

    链接地址: http://www.djcxy.com/p/86548.html

    上一篇: Java parallelStream没有显示正确的结果

    下一篇: 如何计算经过时间的加密和解密算法?