Use this class if you can enforce fixed length for messages. If you need something more general, use the GeneralHashCommitter.
| Modifier and Type | Field and Description |
|---|---|
| private final int | |
| private final Digest | |
| private final SecureRandom |
| Access | Constructor and Description |
|---|---|
| public | HashCommitter(ExtendedDigest
digest to use for creating commitments. digest, SecureRandom source of randomness for generating secrets. random)Base Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| private byte[] | |
| public Commitment | Returns: a Commitmentthe message to be committed to, message)Implements org. Generate a commitment for the passed in message. |
| public boolean | Returns: true if commitment matches message, false otherwise.a commitment previously generated. commitment, byte[] the message that was expected to have been committed to. message)Implements org. Return true if the passed in commitment represents a commitment to the passed in message. |
| byteLength | back to summary |
|---|---|
| private final int byteLength | |
| digest | back to summary |
|---|---|
| private final Digest digest | |
| random | back to summary |
|---|---|
| private final SecureRandom random | |
| HashCommitter | back to summary |
|---|---|
| public HashCommitter(ExtendedDigest digest, SecureRandom random) Base Constructor. The maximum message length that can be committed to is half the length of the internal block size for the digest (ExtendedDigest.getBlockLength()).
| |
| calculateCommitment | back to summary |
|---|---|
| private byte[] calculateCommitment(byte[] w, byte[] message) | |
| commit | back to summary |
|---|---|
| public Commitment commit(byte[] message) Implements org. Generate a commitment for the passed in message.
| |
| isRevealed | back to summary |
|---|---|
| public boolean isRevealed(Commitment commitment, byte[] message) Implements org. Return true if the passed in commitment represents a commitment to the passed in message.
| |