Fix hashCode function for Entry
This commit is contained in:
parent
3543cc9685
commit
ea2b18bde9
1 changed files with 9 additions and 5 deletions
|
@ -44,10 +44,10 @@ public class Entry {
|
||||||
private static final String JSON_PERIOD = "period";
|
private static final String JSON_PERIOD = "period";
|
||||||
private static final String JSON_TYPE = "type";
|
private static final String JSON_TYPE = "type";
|
||||||
|
|
||||||
private OTPType type;
|
private OTPType type = OTPType.TOTP;
|
||||||
private byte[] secret;
|
private byte[] secret;
|
||||||
private String label;
|
private String label;
|
||||||
private int period;
|
private int period = TOTPHelper.TOTP_DEFAULT_PERIOD;
|
||||||
private String currentOTP;
|
private String currentOTP;
|
||||||
private long last_update = 0;
|
private long last_update = 0;
|
||||||
|
|
||||||
|
@ -190,8 +190,12 @@ public class Entry {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int result = secret != null ? Arrays.hashCode(secret) : 0;
|
int hash = 1;
|
||||||
result = 31 * result + (label != null ? label.hashCode() : 0);
|
hash = hash + (secret == null ? 0 : Arrays.hashCode(secret));
|
||||||
return result;
|
hash = hash + 13 * (label == null ? 0 : label.hashCode());
|
||||||
|
hash = hash + 17 * type.hashCode();
|
||||||
|
hash = hash + 31 * period;
|
||||||
|
|
||||||
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue