-
public final class Ristretto255.RistrettoPoint
-
-
Method Summary
Modifier and Type Method Description StringtoString()booleanequals(Object o)inthashCode()StringtoHex()Returns the hexadecimal notation of this point's canonical encoding. Array<byte>toBytes()Returns this point's canonical encoding. Stringencode()Encodes the point using the LazySodium's associated MessageEncoder. Ristretto255.RistrettoPointscalarMult(BigInteger n)Multiplies this point by a given scalar. Ristretto255.RistrettoPointtimes(BigInteger n)Multiplies this point by a given scalar. Ristretto255.RistrettoPointplus(Ristretto255.RistrettoPoint other)Adds the given point to this point. Ristretto255.RistrettoPointminus(Ristretto255.RistrettoPoint other)Subtracts the given point from this point. Ristretto255.RistrettoPointnegate()Returns the additive inverse of this point. static Ristretto255.RistrettoPointzero(LazySodium ls)Returns the zero element (identity element) of the Ristretto255 group. static Ristretto255.RistrettoPointrandom(LazySodium ls)Returns a random element of the Ristretto255 group. static Ristretto255.RistrettoPointbase(LazySodium ls)Returns the base point of the Ristretto255 group. static Ristretto255.RistrettoPointfromHex(LazySodium ls, String hex)Creates a new RistrettoPoint from the hexadecimal representation. static Ristretto255.RistrettoPointfromString(LazySodium ls, String encoded)Creates a new RistrettoPoint from the encoded representation, using the LazySodium's associated MessageEncoder. static Ristretto255.RistrettoPointfromBytes(LazySodium ls, Array<byte> bytes)Creates a new RistrettoPoint from the binary representation. static Ristretto255.RistrettoPointhashToPoint(LazySodium ls, String encodedInput)Maps the encoded input to a RistrettoPoint, using the LazySodium'sassociated MessageEncoder. static Ristretto255.RistrettoPointhashToPoint(LazySodium ls, Array<byte> input)Maps the input to a RistrettoPoint, by calculating the SHA-512 hash andmapping it to the Ristretto 255 group, using {@code crypto_code_ristretto255_from_hash},i.e.-
-
Method Detail
-
hashCode
int hashCode()
-
encode
String encode()
Encodes the point using the LazySodium's associated MessageEncoder.
-
scalarMult
Ristretto255.RistrettoPoint scalarMult(BigInteger n)
Multiplies this point by a given scalar.
- Parameters:
n- the scalar to multiply by
-
times
Ristretto255.RistrettoPoint times(BigInteger n)
Multiplies this point by a given scalar.
- Parameters:
n- the scalar to multiply by
-
plus
Ristretto255.RistrettoPoint plus(Ristretto255.RistrettoPoint other)
Adds the given point to this point. Addition is commutative.
- Parameters:
other- the point to add
-
minus
Ristretto255.RistrettoPoint minus(Ristretto255.RistrettoPoint other)
Subtracts the given point from this point.
- Parameters:
other- the point to subtract
-
negate
Ristretto255.RistrettoPoint negate()
Returns the additive inverse of this point. This is equivalent to
{@code 0 - p}where 0denotes the additive identity.
-
zero
static Ristretto255.RistrettoPoint zero(LazySodium ls)
Returns the zero element (identity element) of the Ristretto255 group.
- Parameters:
ls- the LazySodium instance
-
random
static Ristretto255.RistrettoPoint random(LazySodium ls)
Returns a random element of the Ristretto255 group.
- Parameters:
ls- the LazySodium instance
-
base
static Ristretto255.RistrettoPoint base(LazySodium ls)
Returns the base point of the Ristretto255 group.
- Parameters:
ls- the LazySodium instance
-
fromHex
static Ristretto255.RistrettoPoint fromHex(LazySodium ls, String hex)
Creates a new RistrettoPoint from the hexadecimal representation. The hexadecimalrepresentation must be a valid canonical encoding.
- Parameters:
ls- the LazySodium instancehex- the Ristretto255 canonical encoding in hexadecimal notation
-
fromString
static Ristretto255.RistrettoPoint fromString(LazySodium ls, String encoded)
Creates a new RistrettoPoint from the encoded representation, using the LazySodium's associated MessageEncoder. The decoded bytes must be a validcanonical encoding.
- Parameters:
ls- the LazySodium instanceencoded- the encoded Ristretto255 point
-
fromBytes
static Ristretto255.RistrettoPoint fromBytes(LazySodium ls, Array<byte> bytes)
Creates a new RistrettoPoint from the binary representation. The binaryrepresentation must be a valid canonical encoding.
- Parameters:
ls- the LazySodium instancebytes- the Ristretto255 canonical encoding
-
hashToPoint
static Ristretto255.RistrettoPoint hashToPoint(LazySodium ls, String encodedInput)
Maps the encoded input to a RistrettoPoint, using the LazySodium'sassociated MessageEncoder. The resulting bytes are hashed using SHA-512 andmapped to the Ristretto 255 group, using
{@code crypto_code_ristretto255_from_hash},i.e. the standard hash-to-group algorithm.- Parameters:
ls- the LazySodium instanceencodedInput- the encoded bytes
-
hashToPoint
static Ristretto255.RistrettoPoint hashToPoint(LazySodium ls, Array<byte> input)
Maps the input to a RistrettoPoint, by calculating the SHA-512 hash andmapping it to the Ristretto 255 group, using
{@code crypto_code_ristretto255_from_hash},i.e. the standard hash-to-group algorithm.- Parameters:
ls- the LazySodium instanceinput- the input bytes
-
-
-
-