public class ZnChallengeSpace extends java.lang.Object implements ChallengeSpace
| Modifier and Type | Field and Description |
|---|---|
protected org.cryptimeleon.math.structures.rings.zn.Zn |
zn |
| Constructor and Description |
|---|
ZnChallengeSpace(java.math.BigInteger size) |
ZnChallengeSpace(org.cryptimeleon.math.structures.rings.zn.Zn zn) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
ZnChallenge |
generateRandomChallenge() |
int |
hashCode() |
ZnChallenge |
hashIntoChallengeSpace(byte[] bytes)
Hashes the given bytes into this challenge space (in a random-oracle-like manner).
|
ZnChallenge |
mapIntoChallengeSpace(byte[] bytes)
Creates a challenge from the given
byte[]. |
ZnChallenge |
restoreChallenge(org.cryptimeleon.math.serialization.Representation repr)
Restores a given challenge from representation.
|
java.math.BigInteger |
size()
Returns the size of the challenge space.
|
Challenge |
subtract(Challenge challengeToSplit,
Challenge share1)
Returns the unique challenge share2 such that
subtract(challengeToSplit, share2).equals(share1). |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitrestoreFromRepresentationpublic ZnChallengeSpace(org.cryptimeleon.math.structures.rings.zn.Zn zn)
public ZnChallengeSpace(java.math.BigInteger size)
public ZnChallenge generateRandomChallenge()
generateRandomChallenge in interface ChallengeSpacepublic java.math.BigInteger size()
throws java.lang.UnsupportedOperationException
ChallengeSpaceUnsupportedOperationException if unknown.size in interface ChallengeSpacejava.lang.UnsupportedOperationExceptionpublic ZnChallenge restoreChallenge(org.cryptimeleon.math.serialization.Representation repr)
ChallengeSpacerestoreChallenge in interface ChallengeSpacepublic ZnChallenge mapIntoChallengeSpace(byte[] bytes)
ChallengeSpacebyte[].
Given two random byte[] of the same (arbitrary) length, it should be unlikely that their challenge collides.
mapIntoChallengeSpace in interface ChallengeSpacepublic ZnChallenge hashIntoChallengeSpace(byte[] bytes)
ChallengeSpacehashIntoChallengeSpace in interface ChallengeSpacepublic Challenge subtract(Challenge challengeToSplit, Challenge share1) throws java.lang.UnsupportedOperationException
ChallengeSpacesubtract(challengeToSplit, share2).equals(share1).
This is akin to secret sharing.
For all challengeToSplit, subtract(challengeToSplit, generateRandomChallenge()) shall be distributed like generateRandomChallenge().subtract in interface ChallengeSpacejava.lang.UnsupportedOperationException - if this challenge space does not support splitting challenges.public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object