]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/util/CipherInfo.java
upd: fixes wording
[gigi.git] / src / org / cacert / gigi / util / CipherInfo.java
index 2508fae738a5e400722ec874c0635996002355f7..a1aaecdfb25ff6e27ad0cac402046582757df231 100644 (file)
@@ -256,7 +256,7 @@ public class CipherInfo implements Comparable<CipherInfo> {
         }
         boolean mySHA = macName.startsWith("SHA");
         boolean oSHA = o.macName.startsWith("SHA");
-        if (mySHA && !oSHA) {
+        if ( !mySHA && oSHA) {
             return -1;
         }
         if (mySHA && !oSHA) {
@@ -272,6 +272,30 @@ public class CipherInfo implements Comparable<CipherInfo> {
         return suiteName.compareTo(o.suiteName);
     }
 
+    @Override
+    public boolean equals(Object o) {
+        if (o instanceof CipherInfo) {
+            return 0 == this.compareTo((CipherInfo) o);
+        }
+
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        final int prime = 31;
+        int result = 1;
+        result = prime * result + ((cipher == null) ? 0 : cipher.hashCode());
+        result = prime * result + ((cipherChaining == null) ? 0 : cipherChaining.hashCode());
+        result = prime * result + ((cipherPadding == null) ? 0 : cipherPadding.hashCode());
+        result = prime * result + ((keyExchange == null) ? 0 : keyExchange.hashCode());
+        result = prime * result + keySize;
+        result = prime * result + ((macName == null) ? 0 : macName.hashCode());
+        result = prime * result + macSize;
+        result = prime * result + ((suiteName == null) ? 0 : suiteName.hashCode());
+        return result;
+    }
+
     static String[] cipherRanking = null;
 
     public static String[] getCompleteRanking() {