Skip to content

Commit de84365

Browse files
committed
Dropped unnecessary FieldElement.cmov()
1 parent 1ab2cd3 commit de84365

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

src/net/i2p/crypto/eddsa/math/FieldElement.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,6 @@ public FieldElement pow(FieldElement e){
115115
return pow(e.bi);
116116
}
117117

118-
/**
119-
* Replace this with other if b == 1.
120-
* Replace this with this if b == 0.
121-
* @param other
122-
* @param b in {0, 1}
123-
* @return
124-
*/
125-
public FieldElement cmov(FieldElement other, int b) {
126-
BigInteger x = bi.xor(other.bi);
127-
x = x.and(BigInteger.valueOf(-b));
128-
return new FieldElement(f, bi.xor(x));
129-
}
130-
131118
@Override
132119
public int hashCode() {
133120
return bi.hashCode();

test/net/i2p/crypto/eddsa/math/FieldElementTest.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,6 @@ public void testModPow() {
145145
fail("Not yet implemented");
146146
}
147147

148-
/**
149-
* Test method for {@link FieldElement#cmov(FieldElement, int)}.
150-
*/
151-
@Test
152-
public void testCmov() {
153-
assertThat(ZERO.cmov(ONE, 0), is(equalTo(ZERO)));
154-
assertThat(ZERO.cmov(ONE, 1), is(equalTo(ONE)));
155-
FieldElement five = new FieldElement(ed25519Field, Constants.FIVE);
156-
FieldElement notfive = new FieldElement(ed25519Field, BigInteger.valueOf(321));
157-
assertThat(five.cmov(notfive, 0), is(five));
158-
assertThat(five.cmov(notfive, 1), is(notfive));
159-
}
160-
161148
/**
162149
* Test method for {@link FieldElement#equals(java.lang.Object)}.
163150
*/

0 commit comments

Comments
 (0)