diff options
author | Florian Dold <florian.dold@gmail.com> | 2014-02-25 11:15:15 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2014-02-25 11:15:15 +0000 |
commit | 85d0048c22271fac371729ba7b14417a28bb6b48 (patch) | |
tree | de231f5453baed5b406bb88b19496d16530f3850 /src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java | |
parent | 989f297285b843cb631836bf42e47f25fb567418 (diff) | |
download | gnunet-java-85d0048c22271fac371729ba7b14417a28bb6b48.tar.gz gnunet-java-85d0048c22271fac371729ba7b14417a28bb6b48.zip |
- support mesh's new NACK message
- remove
- python test skeleton for voting
- encrypted votes
- establish threshold key during ballot registration
- ballot tool can request threshold public keys from authorities
Diffstat (limited to 'src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java')
-rw-r--r-- | src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java b/src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java index b7075be..4560788 100644 --- a/src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java +++ b/src/main/java/org/gnunet/secretsharing/ThresholdPublicKey.java | |||
@@ -22,11 +22,40 @@ package org.gnunet.secretsharing; | |||
22 | 22 | ||
23 | import org.gnunet.construct.FixedSizeIntegerArray; | 23 | import org.gnunet.construct.FixedSizeIntegerArray; |
24 | import org.gnunet.construct.Message; | 24 | import org.gnunet.construct.Message; |
25 | import org.gnunet.util.Strings; | ||
26 | |||
27 | import java.util.Arrays; | ||
25 | 28 | ||
26 | /** | 29 | /** |
27 | * Threshold public key. | 30 | * Threshold public key. |
28 | */ | 31 | */ |
29 | public class ThresholdPublicKey implements Message { | 32 | public class ThresholdPublicKey implements Message { |
33 | |||
30 | @FixedSizeIntegerArray(signed = true, bitSize = 8, length = Parameters.elgamalBits / 8) | 34 | @FixedSizeIntegerArray(signed = true, bitSize = 8, length = Parameters.elgamalBits / 8) |
31 | public byte[] bits; | 35 | public byte[] bits; |
36 | |||
37 | @Override | ||
38 | public boolean equals(Object o) { | ||
39 | if (this == o) return true; | ||
40 | if (o == null || getClass() != o.getClass()) return false; | ||
41 | ThresholdPublicKey that = (ThresholdPublicKey) o; | ||
42 | return Arrays.equals(bits, that.bits); | ||
43 | } | ||
44 | |||
45 | @Override | ||
46 | public int hashCode() { | ||
47 | return bits != null ? Arrays.hashCode(bits) : 0; | ||
48 | } | ||
49 | |||
50 | public static ThresholdPublicKey fromString(String value) { | ||
51 | ThresholdPublicKey pk = new ThresholdPublicKey(); | ||
52 | pk.bits = new byte[Parameters.elgamalBits / 8]; | ||
53 | Strings.stringToData(value, pk.bits); | ||
54 | return pk; | ||
55 | } | ||
56 | |||
57 | @Override | ||
58 | public String toString() { | ||
59 | return Strings.dataToString(bits); | ||
60 | } | ||
32 | } | 61 | } |