Class GeneralHashCommitter
- java.lang.Object
-
- org.bouncycastle.crypto.commitments.GeneralHashCommitter
-
- All Implemented Interfaces:
Committer
public class GeneralHashCommitter extends java.lang.Object implements Committer
A basic hash-committer based on the one described in "Making Mix Nets Robust for Electronic Voting by Randomized Partial Checking", by Jakobsson, Juels, and Rivest (11th Usenix Security Symposium, 2002).The algorithm used by this class differs from the one given in that it includes the length of the message in the hash calculation.
-
-
Constructor Summary
Constructors Constructor Description GeneralHashCommitter(ExtendedDigest digest, java.security.SecureRandom random)
Base Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Constructor Detail
-
GeneralHashCommitter
public GeneralHashCommitter(ExtendedDigest digest, java.security.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()).- Parameters:
digest
- digest to use for creating commitments.random
- source of randomness for generating secrets.
-
-
Method Detail
-
commit
public Commitment commit(byte[] message)
Generate a commitment for the passed in message.
-
isRevealed
public boolean isRevealed(Commitment commitment, byte[] message)
Return true if the passed in commitment represents a commitment to the passed in message.- Specified by:
isRevealed
in interfaceCommitter
- Parameters:
commitment
- a commitment previously generated.message
- the message that was expected to have been committed to.- Returns:
- true if commitment matches message, false otherwise.
-
-