Skip to content

Commit

Permalink
[misc] ed25519 update to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rusher committed Oct 18, 2023
1 parent 875d9f0 commit 6a77c87
Show file tree
Hide file tree
Showing 9 changed files with 294 additions and 110 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static byte[] ed25519SignWithPassword(final String password, final byte[
final byte[] sm = new byte[64 + mlen];

byte[] az = hash.digest(bytePwd);
az[0] &= 248;
az[0] &= (byte) 248;
az[31] &= 63;
az[31] |= 64;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Curve implements Serializable {
private final GroupElement zeroP3PrecomputedDouble;
private final GroupElement zeroPrecomp;

@SuppressWarnings({"this-escape"})
public Curve(Field f, byte[] d, FieldElement I) {
this.f = f;
this.d = f.fromByteArray(d);
Expand Down Expand Up @@ -76,8 +77,7 @@ public int hashCode() {
@Override
public boolean equals(Object o) {
if (o == this) return true;
if (!(o instanceof Curve)) return false;
Curve c = (Curve) o;
if (!(o instanceof Curve c)) return false;
return f.equals(c.getField()) && d.equals(c.getD()) && I.equals(c.getI());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* @author str4d
*/
@SuppressWarnings("all")
public class Field implements Serializable {
private static final long serialVersionUID = 8746587465875676L;

Expand All @@ -28,6 +29,7 @@ public class Field implements Serializable {

private final Encoding enc;

@SuppressWarnings({"this-escape"})
public Field(int b, byte[] q, Encoding enc) {
this.b = b;
this.enc = enc;
Expand Down Expand Up @@ -56,6 +58,18 @@ public int getb() {
return b;
}

public FieldElement getQ() {
return q;
}

public FieldElement getQm2() {
return qm2;
}

public FieldElement getQm5d8() {
return qm5d8;
}

public Encoding getEncoding() {
return enc;
}
Expand Down

0 comments on commit 6a77c87

Please sign in to comment.