Package com.swmansion.starknet.crypto
Object StarknetCurve
-
- All Implemented Interfaces:
public class StarknetCurve
Starknet curve utilities.
Class with utility methods related to starknet curve signatures generation and verification.
-
-
Field Summary
Fields Modifier and Type Field Description public final static BigInteger
CURVE_ORDER
public final static StarknetCurve
INSTANCE
-
Method Summary
Modifier and Type Method Description final static Felt
pedersen(Felt first, Felt second)
Compute pedersen hash on input values final static Felt
pedersen(Iterable<Felt> values)
Compute pedersen hash on iterable of Felts. final static Felt
pedersenOnElements(Collection<Felt> values)
Compute pedersen hash on collection of Felts. final static Felt
pedersenOnElements(Felt values)
Compute pedersen hash on variable number of arguments. final static StarknetCurveSignature
sign(Felt privateKey, Felt hash)
Sign a provided hash. final static Boolean
verify(Felt publicKey, Felt hash, Felt r, Felt s)
Verify a signature. final static Felt
getPublicKey(Felt privateKey)
Get a public key for provided private key. -
-
Method Detail
-
pedersen
final static Felt pedersen(Iterable<Felt> values)
Compute pedersen hash on iterable of Felts.
- Parameters:
values
- an iterable of Felts
-
pedersenOnElements
final static Felt pedersenOnElements(Collection<Felt> values)
Compute pedersen hash on collection of Felts.
- Parameters:
values
- a collection of Felts
-
pedersenOnElements
final static Felt pedersenOnElements(Felt values)
Compute pedersen hash on variable number of arguments.
- Parameters:
values
- any number of Felts
-
sign
final static StarknetCurveSignature sign(Felt privateKey, Felt hash)
Sign a provided hash.
- Parameters:
privateKey
- a private key used to generate a signaturehash
- a hash to be signed
-
verify
final static Boolean verify(Felt publicKey, Felt hash, Felt r, Felt s)
Verify a signature.
- Parameters:
publicKey
- a public key to be used to verify a signaturehash
- a value that was signedr
- part of signatures
- part of signature
-
getPublicKey
final static Felt getPublicKey(Felt privateKey)
Get a public key for provided private key.
- Parameters:
privateKey
- a private key from which public key will be derived
-
-
-
-