public class BigIntegerLittleEndianEncoding extends Encoding implements Serializable
| Constructor and Description |
|---|
BigIntegerLittleEndianEncoding()Constructor |
| 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)Set the field. |
BigInteger | toBigInteger(byte[] in)Convert in to big endian |
public FieldElement decode(byte[] in)
decode in class Encodingin - the $(b-1)$-bit encoding of a FieldElement.IllegalStateException - if field not setIllegalArgumentException - if encoding is invalidpublic byte[] encode(BigInteger x)
x - the BigInteger value to encodeIllegalStateException - if field not setpublic byte[] encode(FieldElement x)
public boolean isNegative(FieldElement x)
isNegative in class Encodingx - the FieldElement to checkpublic BigInteger toBigInteger(byte[] in)
in - the $(b-1)$-bit encoding of a FieldElement.