Class HashToField
java.lang.Object
org.bouncycastle.crypto.hash2curve.HashToField
Generic implementation of hash to field
This implementation is restricted to hashing to a field where the field being hashed to is derived from an Elliptic curve
The HashToField function can be used to hash to any field such as a scalar field (group order) This implementation is not suitable for such cases as described in more detail in the GenericOPRFHashToScalar function. Instead, this class is strictly used to implement HashToField when hashing is done to curve order as this is the way the function is used in HashToEllipticCurve operations.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ECCurveprotected final byte[]protected intSecurity parameter for the suiteprotected intprotected final MessageExpansionprotected BigInteger -
Constructor Summary
ConstructorsConstructorDescriptionHashToField(byte[] dst, ECCurve curve, MessageExpansion messageExpansion, int L) Constructs a new instance of the HashToCurveField class. -
Method Summary
Modifier and TypeMethodDescriptionBigInteger[][]process(byte[] message, int count) Processes the input message and hashes it into a multidimensional array of elements in a finite field derived from an elliptic curve.
-
Field Details
-
dst
protected final byte[] dst -
curve
-
messageExpansion
-
L
protected int LSecurity parameter for the suite -
m
protected int m -
p
-
-
Constructor Details
-
HashToField
Constructs a new instance of the HashToCurveField class.This constructor allows the creation of a hash-to-field mechanism tied to an elliptic curve, with parameters specifying domain separation, message expansion mechanics, security level, and the count of resulting field elements.
- Parameters:
dst- The domain separation tag, used to separate different domains of usage to ensure distinct use cases do not produce the same output for the same input.curve- The elliptic curve from which the field to hash to is derived.messageExpansion- The mechanism for expanding input messages, ensuring the required cryptographic properties for subsequent field hashing.L- The security parameter for the suite, determining the byte length of individual elements used in the computation.
-
-
Method Details
-
process
Processes the input message and hashes it into a multidimensional array of elements in a finite field derived from an elliptic curve. The hashing mechanism leverages message expansion and modular arithmetic to ensure cryptographic security.- Parameters:
message- The input message to be hashed into field elements.count- The number of resulting field elements to be produced during the hashing process.- Returns:
- A two-dimensional array of BigInteger, where each entry represents a field element derived from the input message.
-