public class HashCommitter extends Object implements Committer
Use this class if you can enforce fixed length for messages. If you need something more general, use the GeneralHashCommitter.
Constructor and Description |
---|
HashCommitter(ExtendedDigest digest,
SecureRandom random)
Base Constructor.
|
Modifier and Type | Method and Description |
---|---|
Commitment |
commit(byte[] message)
Generate a commitment for the passed in message.
|
boolean |
isRevealed(Commitment commitment,
byte[] message)
Return true if the passed in commitment represents a commitment to the passed in message.
|
public HashCommitter(ExtendedDigest digest, SecureRandom random)
digest
- digest to use for creating commitments.random
- source of randomness for generating secrets.public Commitment commit(byte[] message)
public boolean isRevealed(Commitment commitment, byte[] message)
isRevealed
in interface Committer
commitment
- a commitment previously generated.message
- the message that was expected to have been committed to.Copyright © 2020 BouncyCastle.org. All rights reserved.