Skip to content

Commit

Permalink
Move Ed25519 to the encoding package - it's only used by the SolanaPr…
Browse files Browse the repository at this point in the history
…ogramDerivedAddress so just put it next to it in the package
  • Loading branch information
ml-james committed Oct 29, 2024
1 parent a60fe48 commit dfe96f5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.lmax.solana4j;
package com.lmax.solana4j.encoding;

import com.lmax.solana4j.util.Ed25519;
import com.lmax.solana4j.util.TestKeyPairGenerator;
import net.i2p.crypto.eddsa.math.GroupElement;
import org.openjdk.jmh.annotations.Benchmark;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.lmax.solana4j.util;
package com.lmax.solana4j.encoding;

import java.math.BigInteger;

Expand All @@ -14,7 +14,7 @@
* The Ed25519 curve equation is:
* dx^2y^2 + x^2 = y^2 - 1 (mod P), where d is a curve constant.
*/
public final class Ed25519
final class Ed25519
{
private static final BigInteger P = new BigInteger("7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed", 16);
private static final BigInteger D = new BigInteger("52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3", 16);
Expand All @@ -31,7 +31,7 @@ private Ed25519()
* @return true if the point is on the curve, false otherwise.
* @throws IllegalArgumentException if the public key byte array is not 32 bytes long.
*/
public static boolean isOnCurve(final byte[] publicKeyBytes)
static boolean isOnCurve(final byte[] publicKeyBytes)
{
if (publicKeyBytes.length != 32)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.lmax.solana4j.api.ProgramDerivedAddress;
import com.lmax.solana4j.api.PublicKey;
import com.lmax.solana4j.util.Ed25519;

import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.lmax.solana4j.util;
package com.lmax.solana4j.encoding;

import com.lmax.solana4j.util.TestKeyPairGenerator;
import net.i2p.crypto.eddsa.math.GroupElement;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand Down

0 comments on commit dfe96f5

Please sign in to comment.