@Override public int hashCode() { synchronized (this) { if (h == 0) { h = Objects.hashCode(getAlgorithm()) + getBlockSize(); if (h == 0) { h = 1; } } } return h; }
@Override public String toString() { synchronized (this) { if (s == null) { s = getClass().getSimpleName() + "[" + getAlgorithm() + ":" + getBlockSize() + "]"; } } return s; } }
@Override public int hashCode() { synchronized (this) { if (h == 0) { h = Objects.hashCode(getAlgorithm()) + getBlockSize(); if (h == 0) { h = 1; } } } return h; }
@Override public String toString() { synchronized (this) { if (s == null) { s = getClass().getSimpleName() + "[" + getAlgorithm() + ":" + getBlockSize() + "]"; } } return s; } }
@Override public void init() throws Exception { this.md = SecurityUtils.getMessageDigest(getAlgorithm()); }
@Override public void init() throws Exception { this.md = SecurityUtils.getMessageDigest(getAlgorithm()); }
@Override public int compareTo(Digest that) { if (that == null) { return -1; // push null(s) to end } else if (this == that) { return 0; } String thisAlg = getAlgorithm(); String thatAlg = that.getAlgorithm(); int nRes = GenericUtils.safeCompare(thisAlg, thatAlg, false); if (nRes != 0) { return nRes; // debug breakpoint } nRes = Integer.compare(this.getBlockSize(), that.getBlockSize()); if (nRes != 0) { return nRes; // debug breakpoint } return 0; }
@Override public int compareTo(Digest that) { if (that == null) { return -1; // push null(s) to end } else if (this == that) { return 0; } String thisAlg = getAlgorithm(); String thatAlg = that.getAlgorithm(); int nRes = GenericUtils.safeCompare(thisAlg, thatAlg, false); if (nRes != 0) { return nRes; // debug breakpoint } nRes = Integer.compare(this.getBlockSize(), that.getBlockSize()); if (nRes != 0) { return nRes; // debug breakpoint } return 0; }