Class XmdMessageExpansion
- java.lang.Object
-
- org.bouncycastle.crypto.hash2curve.impl.XmdMessageExpansion
-
- All Implemented Interfaces:
MessageExpansion
public class XmdMessageExpansion extends java.lang.Object implements MessageExpansion
XmdMessageExpansion is an implementation of the MessageExpansion interface, used to expand a given message to a specified length in bytes while following cryptographic domain separation principles. The implementation uses a selected hash function to achieve the expansion.
-
-
Constructor Summary
Constructors Constructor Description XmdMessageExpansion(Digest digest, int k, int s)Constructs an XmdMessageExpansion instance capable of performing cryptographic message expansion using the specified digest algorithm, security parameter, and custom input block size parameter.XmdMessageExpansion(ExtendedDigest digest, int k)Constructs an XmdMessageExpansion instance with the given digest algorithm and security parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]expandMessage(byte[] msg, byte[] dst, int lenInBytes)Expands a given input message to a fixed-length output, using a cryptographic digest and additional parameters such as domain separation tag (DST) and desired output length.
-
-
-
Constructor Detail
-
XmdMessageExpansion
public XmdMessageExpansion(Digest digest, int k, int s)
Constructs an XmdMessageExpansion instance capable of performing cryptographic message expansion using the specified digest algorithm, security parameter, and custom input block size parameter. The security of the curve's operations is validated against the output size of the digest algorithm.- Parameters:
digest- the cryptographic digest algorithm to be usedk- the security parameter defining the required minimum security strength, in bitss- the input block size parameter for the cryptographic digest algorithm- Throws:
java.lang.IllegalArgumentException- if the hash output size is too small for the specified security level
-
XmdMessageExpansion
public XmdMessageExpansion(ExtendedDigest digest, int k)
Constructs an XmdMessageExpansion instance with the given digest algorithm and security parameter.- Parameters:
digest- the cryptographic digest algorithm to be usedk- the security parameter defining the required minimum security strength
-
-
Method Detail
-
expandMessage
public byte[] expandMessage(byte[] msg, byte[] dst, int lenInBytes)Expands a given input message to a fixed-length output, using a cryptographic digest and additional parameters such as domain separation tag (DST) and desired output length. This method is compliant with hash-to-curve message expansion defined in certain cryptographic algorithms and standards.- Specified by:
expandMessagein interfaceMessageExpansion- Parameters:
msg- the input message to be expandeddst- the domain separation tag used to isolate cryptographic domainslenInBytes- the desired byte-length of the output message- Returns:
- the byte array resulting from the message expansion process
- Throws:
java.lang.IllegalArgumentException- if ell exceeds 255, lenInBytes exceeds 65535, or dst length is greater than 255
-
-