Sunday, December 23, 2018

java - How compute elapsed time encrypt and decrypt algorithm?

for (int ii = 0 ; ii < 200 ; ii++)
{
encrypt();
}

long start = System.currentTimeMillis();
for (int ii = 0 ; ii < 2000 ; ii++)

{
encrypt();
}
long elapsed = System.currentTimeMillis() - start;

for (int ii = 0 ; ii < 200 ; ii++)
{
decrypt();
}


long start = System.currentTimeMillis();
for (int ii = 0 ; ii < 2000 ; ii++)
{
decrypt();
}
long elapsed = System.currentTimeMillis() - start;



private void encrypt()

{
M = new BigInteger(64,random);
C = M.multiply(k).mod(N);
}

private void decrypt()
{
kk= k.modinverse(N);
Mp = kk.multiply(c).mod(N);
}



But I feel that the results are incorrect when run this program on netbeans platform.
Is there way to compare any two algorithm cryptography under execution time .
Is necessary decrypt algorithm take long time than encrypt algorithm?
Please any suggest.

No comments:

Post a Comment

plot explanation - Why did Peaches&#39; mom hang on the tree? - Movies &amp; TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...