equal
deleted
inserted
replaced
|
1 /* |
|
2 * otr4j, the open source java otr library. |
|
3 * |
|
4 * Distributable under LGPL license. |
|
5 * See terms of license at gnu.org. |
|
6 */ |
|
7 package net.java.otr4j.io.messages; |
|
8 |
|
9 import java.util.Arrays; |
|
10 |
|
11 /** |
|
12 * |
|
13 * @author George Politis |
|
14 */ |
|
15 public class DHCommitMessage extends AbstractEncodedMessage { |
|
16 |
|
17 // Fields. |
|
18 public byte[] dhPublicKeyEncrypted; |
|
19 public byte[] dhPublicKeyHash; |
|
20 |
|
21 // Ctor. |
|
22 public DHCommitMessage(int protocolVersion, byte[] dhPublicKeyHash, |
|
23 byte[] dhPublicKeyEncrypted) { |
|
24 super(MESSAGE_DH_COMMIT, protocolVersion); |
|
25 this.dhPublicKeyEncrypted = dhPublicKeyEncrypted; |
|
26 this.dhPublicKeyHash = dhPublicKeyHash; |
|
27 } |
|
28 |
|
29 // Methods. |
|
30 @Override |
|
31 public int hashCode() { |
|
32 final int prime = 31; |
|
33 int result = super.hashCode(); |
|
34 result = prime * result + Arrays.hashCode(dhPublicKeyEncrypted); |
|
35 result = prime * result + Arrays.hashCode(dhPublicKeyHash); |
|
36 return result; |
|
37 } |
|
38 |
|
39 @Override |
|
40 public boolean equals(Object obj) { |
|
41 if (this == obj) |
|
42 return true; |
|
43 if (!super.equals(obj)) |
|
44 return false; |
|
45 if (getClass() != obj.getClass()) |
|
46 return false; |
|
47 DHCommitMessage other = (DHCommitMessage) obj; |
|
48 if (!Arrays.equals(dhPublicKeyEncrypted, other.dhPublicKeyEncrypted)) |
|
49 return false; |
|
50 if (!Arrays.equals(dhPublicKeyHash, other.dhPublicKeyHash)) |
|
51 return false; |
|
52 return true; |
|
53 } |
|
54 |
|
55 } |