We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 53e397b commit c85a8adCopy full SHA for c85a8ad
highcpu/src/main/java/com/github/chrishantha/sample/highcpu/HashingWorker.java
@@ -24,6 +24,8 @@ public class HashingWorker implements Runnable {
24
private final String algorithm;
25
private final long length;
26
27
+ private byte[] lastComputedHash;
28
+
29
public HashingWorker(long length, String algorithm) {
30
this.length = length;
31
this.algorithm = algorithm;
@@ -48,6 +50,11 @@ public void run() {
48
50
49
51
// Hash
52
digest.update(data.getBytes());
53
+ byte[] computedHash = digest.digest();
54
+ if (lastComputedHash != null && computedHash.length != lastComputedHash.length) {
55
+ throw new IllegalStateException("Is the hash computation correct??");
56
+ }
57
+ lastComputedHash = computedHash;
58
}
59
60
0 commit comments