Thursday, 15 January 2015

java - How compute elapsed time encrypt and decrypt algorithm? -



java - How compute elapsed time encrypt and decrypt algorithm? -

this question has reply here:

how write right micro-benchmark in java? 10 answers for (int ii = 0 ; ii < 200 ; ii++) { encrypt(); } long start = system.currenttimemillis(); (int ii = 0 ; ii < 2000 ; ii++) { encrypt(); } long elapsed = system.currenttimemillis() - start; (int ii = 0 ; ii < 200 ; ii++) { decrypt(); } long start = system.currenttimemillis(); (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 sense results wrong when run programme on netbeans platform. there way compare 2 algorithm cryptography under execution time . necessary decrypt algorithm take long time encrypt algorithm? please suggest.

first of all, encrypt , decrypt methods not right serious security.

the encryption method seems contain generation of random biginteger. when generating key pair (and generate prime, not random integer, @ to the lowest degree rsa algorithm). kind of encryption/decryption method is beyond me.

furthermore, takes long time java vm optimize. best off using high number of testing rounds, split elapsed time number of rounds.

your current output much hinges on state of random number generator. if entropy depleted, take long time generate new numbers.

java performance cryptography

No comments:

Post a Comment