diff options
Diffstat (limited to 'src/org/gnunet/util/HashCode.java')
-rw-r--r-- | src/org/gnunet/util/HashCode.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/org/gnunet/util/HashCode.java b/src/org/gnunet/util/HashCode.java index 02db150..3c3996e 100644 --- a/src/org/gnunet/util/HashCode.java +++ b/src/org/gnunet/util/HashCode.java | |||
@@ -21,11 +21,12 @@ | |||
21 | package org.gnunet.util; | 21 | package org.gnunet.util; |
22 | 22 | ||
23 | 23 | ||
24 | import org.gnunet.construct.FixedSizeByteArray; | 24 | import org.gnunet.construct.FixedSizeIntegerArray; |
25 | import org.gnunet.construct.Message; | 25 | import org.gnunet.construct.Message; |
26 | 26 | ||
27 | import java.security.MessageDigest; | 27 | import java.security.MessageDigest; |
28 | import java.security.NoSuchAlgorithmException; | 28 | import java.security.NoSuchAlgorithmException; |
29 | import java.util.Arrays; | ||
29 | 30 | ||
30 | 31 | ||
31 | /** | 32 | /** |
@@ -33,7 +34,7 @@ import java.security.NoSuchAlgorithmException; | |||
33 | */ | 34 | */ |
34 | public class HashCode implements Message { | 35 | public class HashCode implements Message { |
35 | 36 | ||
36 | @FixedSizeByteArray(length = 64) | 37 | @FixedSizeIntegerArray(length = 64, signed = false, bitSize = 8) |
37 | public byte[] data; // should be immutable, final, can't be due to construct | 38 | public byte[] data; // should be immutable, final, can't be due to construct |
38 | 39 | ||
39 | 40 | ||
@@ -45,7 +46,7 @@ public class HashCode implements Message { | |||
45 | if (hash.length != 64) { | 46 | if (hash.length != 64) { |
46 | throw new AssertionError("HashCode has to have length 64"); | 47 | throw new AssertionError("HashCode has to have length 64"); |
47 | } | 48 | } |
48 | data = hash; | 49 | data = Arrays.copyOf(hash, hash.length); |
49 | } | 50 | } |
50 | 51 | ||
51 | /** | 52 | /** |