public class BigIntegerLittleEndianEncoding extends Encoding implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.math.BigInteger |
mask
Mask where only the first b-1 bits are set.
|
private static long |
serialVersionUID |
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(java.math.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) |
java.math.BigInteger |
toBigInteger(byte[] in)
Convert in to big endian
|
private static final long serialVersionUID
private java.math.BigInteger mask
public byte[] encode(FieldElement x)
Encoding
public byte[] encode(java.math.BigInteger x)
x
- the BigInteger value to encodejava.lang.IllegalStateException
- if field not setpublic FieldElement decode(byte[] in)
public java.math.BigInteger toBigInteger(byte[] in)
in
- the $(b-1)$-bit encoding of a FieldElement.public boolean isNegative(FieldElement x)
isNegative
in class Encoding
x
- the FieldElement to check