We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b08e16f commit 9968234Copy full SHA for 9968234
1 file changed
src/main/java/org/jruby/ext/openssl/SimpleSecretKey.java
@@ -27,6 +27,7 @@
27
***** END LICENSE BLOCK *****/
28
package org.jruby.ext.openssl;
29
30
+import java.security.MessageDigest;
31
import javax.crypto.SecretKey;
32
33
/**
@@ -68,12 +69,8 @@ public String getFormat() {
68
69
70
public boolean equals(Object o) {
71
if ( o instanceof SimpleSecretKey ) {
- byte[] ovalue = ((SimpleSecretKey) o).value;
72
- if ( value.length != ovalue.length ) return false;
73
- for ( int i = 0; i < value.length; i++ ) {
74
- if ( value[i] != ovalue[i] ) return false;
75
- }
76
- return algorithm.equals( ((SimpleSecretKey) o).algorithm );
+ SimpleSecretKey other = (SimpleSecretKey) o;
+ return algorithm.equals(other.algorithm) && MessageDigest.isEqual(value, other.value);
77
}
78
return false;
79
0 commit comments