diff --git a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java index 372030a9..736eca93 100644 --- a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java +++ b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/EqualVerifyTest.java @@ -39,35 +39,29 @@ public class EqualVerifyTest { byte[] responderOutput; boolean isEqual; - int i; + + sponsorInput = 666; + responderInput = 666; - for (i = 0; i < 1000; i++) { - - sponsorInput = 666; - responderInput = 666; - - sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); - responderOutput = EqualVerify.responder(responderInput,sponsorOutput, + sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); + responderOutput = EqualVerify.responder(responderInput,sponsorOutput, responderEPubKeyBytes,responderEPrivKeyBytes); - isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); + isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); - assertTrue(isEqual); - } + assertTrue(isEqual); - for (i = 0; i < 1000; i++){ - sponsorInput = 666; - responderInput = 667; + sponsorInput = 666; + responderInput = 667; - sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); - responderOutput = EqualVerify.responder(responderInput,sponsorOutput, + sponsorOutput = EqualVerify.sponsor(sponsorInput,sponsorEPubKeyBytes); + responderOutput = EqualVerify.responder(responderInput,sponsorOutput, responderEPubKeyBytes,responderEPrivKeyBytes); - isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); + isEqual = EqualVerify.sponsorCheck(sponsorInput,responderOutput,sponsorEPrivKeyBytes); - assertTrue(!isEqual); + assertTrue(!isEqual); } } - } \ No newline at end of file diff --git a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java index d02f668d..d49792eb 100644 --- a/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java +++ b/source/crypto/crypto-adv/src/test/java/test/com/jd/blockchain/crypto/mpc/IntCompareTest.java @@ -25,26 +25,22 @@ public class IntCompareTest { byte[][] cipherArray; byte[][] aggregatedCipherArray; int output; - int i; - for (i = 0; i < 1000; i++) { - int sponsorInput = 10000; - int responderInput = 9999; + int sponsorInput = 10000; + int responderInput = 9999; cipherArray = IntCompare.sponsor(sponsorInput, pubKeyBytes); aggregatedCipherArray = IntCompare.responder(responderInput, cipherArray, pubKeyBytes); output = IntCompare.sponsorOutput(aggregatedCipherArray, privKeyBytes); assertEquals(1, output); - } - for (i = 0; i < 1000; i++) { - int sponsorInput = 10000; - int responderInput = 19999; - cipherArray = IntCompare.sponsor(sponsorInput, pubKeyBytes); - aggregatedCipherArray = IntCompare.responder(responderInput, cipherArray, pubKeyBytes); - output = IntCompare.sponsorOutput(aggregatedCipherArray, privKeyBytes); - assertEquals(0, output); - } + sponsorInput = 10000; + responderInput = 19999; + + cipherArray = IntCompare.sponsor(sponsorInput, pubKeyBytes); + aggregatedCipherArray = IntCompare.responder(responderInput, cipherArray, pubKeyBytes); + output = IntCompare.sponsorOutput(aggregatedCipherArray, privKeyBytes); + assertEquals(0, output); } } \ No newline at end of file