public class BigIntegerLittleEndianEncoding extends Encoding implements Serializable
Constructor and Description |
---|
BigIntegerLittleEndianEncoding() |
Modifier and Type | Method and Description |
---|---|
FieldElement |
decode(byte[] in)
Decode a FieldElement from its (b-1)-bit encoding.
|
byte[] |
encode(BigInteger x)
Convert x to little endian.
|
byte[] |
encode(FieldElement x)
Encode a FieldElement in its (b-1)-bit encoding.
|
boolean |
isNegative(FieldElement x)
From the Ed25519 paper:
x is negative if the (b-1)-bit encoding of x is lexicographically larger than the (b-1)-bit encoding of -x. |
void |
setField(Field f) |
BigInteger |
toBigInteger(byte[] in)
Convert in to big endian
|
public byte[] encode(FieldElement x)
Encoding
public byte[] encode(BigInteger x)
IllegalStateException
- if field not setpublic FieldElement decode(byte[] in)
decode
in class Encoding
in
- the (b-1)-bit encoding of a FieldElement.IllegalStateException
- if field not setIllegalArgumentException
- if encoding is invalidpublic BigInteger toBigInteger(byte[] in)
public boolean isNegative(FieldElement x)
isNegative
in class Encoding