public class HashThenCommitCommitmentScheme extends java.lang.Object implements CommitmentScheme
| Constructor and Description |
|---|
HashThenCommitCommitmentScheme(CommitmentScheme encapsulatedScheme,
org.cryptimeleon.math.hash.HashFunction hashFunction)
Constructor for
HashThenCommitCommitmentScheme. |
HashThenCommitCommitmentScheme(org.cryptimeleon.math.serialization.Representation repr)
Constructor for a
HashThenCommitCommitmentScheme-instance from a Representation. |
| Modifier and Type | Method and Description |
|---|---|
CommitmentPair |
commit(PlainText plainText)
Returns a commitment to the hash of the given message, computed via the previously defined hash function.
|
boolean |
equals(java.lang.Object o) |
org.cryptimeleon.math.serialization.Representation |
getRepresentation() |
int |
hashCode() |
PlainText |
mapToPlainText(byte[] bytes)
Provides an injective mapping of the given
byte[] to a PlainText usable with this scheme
(which may be a MessageBlock). |
Commitment |
restoreCommitment(org.cryptimeleon.math.serialization.Representation repr) |
OpenValue |
restoreOpenValue(org.cryptimeleon.math.serialization.Representation repr) |
boolean |
verify(Commitment commitment,
OpenValue openValue,
PlainText plainText)
Verifies that the hash of the given announced
PlainText equals the result of opening
the Commitment with the OpenValue. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrestoreCommitmentPair, restoreFromRepresentationpublic HashThenCommitCommitmentScheme(CommitmentScheme encapsulatedScheme, org.cryptimeleon.math.hash.HashFunction hashFunction)
HashThenCommitCommitmentScheme.encapsulatedScheme - single-message-CommitmentScheme which shall be used in combination with a
HashFunctionhashFunction - HashFunction used for hashing of the original messagepublic HashThenCommitCommitmentScheme(org.cryptimeleon.math.serialization.Representation repr)
HashThenCommitCommitmentScheme-instance from a Representation.repr - Representation of a HashThenCommitCommitmentScheme instancepublic CommitmentPair commit(PlainText plainText)
commit in interface CommitmentSchemeplainText - ByteArrayImplementation of the message to be hashed.public boolean verify(Commitment commitment, OpenValue openValue, PlainText plainText)
PlainText equals the result of opening
the Commitment with the OpenValue.verify in interface CommitmentSchemecommitment - commitment to verifyopenValue - used to open the commitment and reveal the contentplainText - the hash of this will be compared with the opened commitment messagepublic PlainText mapToPlainText(byte[] bytes) throws java.lang.IllegalArgumentException
CommitmentSchemebyte[] to a PlainText usable with this scheme
(which may be a MessageBlock).
It only guarantees injectivity for arrays of the same length.
Applications that would like to use mapToPlaintext with multiple different array lengths
may want to devise a padding method and then only call mapToPlaintext with
byte arrays of the same (padded) length.mapToPlainText in interface CommitmentSchemebytes - byte[] to map to a PlainText that can be committed to using this commitment schemePlainText usable with this commitment schemejava.lang.IllegalArgumentException - if there is no injective PlainText element corresponding to the given
bytes, for example if the byte array is too longpublic Commitment restoreCommitment(org.cryptimeleon.math.serialization.Representation repr)
restoreCommitment in interface CommitmentSchemepublic OpenValue restoreOpenValue(org.cryptimeleon.math.serialization.Representation repr)
restoreOpenValue in interface CommitmentSchemepublic org.cryptimeleon.math.serialization.Representation getRepresentation()
getRepresentation in interface org.cryptimeleon.math.serialization.Representablepublic boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object