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)
Encodingpublic byte[] encode(BigInteger x)
x - the BigInteger value to encodeIllegalStateException - if field not setpublic 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 BigInteger toBigInteger(byte[] in)
in - the $(b-1)$-bit encoding of a FieldElement.public boolean isNegative(FieldElement x)
isNegative in class Encodingx - the FieldElement to checkCopyright © 2019. All rights reserved.