Skip to content

Commit f067a4f

Browse files
authored
Merge pull request #2 from CodeDead/release/1.7.3
Release/1.7.3
2 parents 1e5b26d + d7ab006 commit f067a4f

File tree

13 files changed

+208
-343
lines changed

13 files changed

+208
-343
lines changed

README.md

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
# DeadHash
2+
23
DeadHash is a freeware utility to calculate file and text hashes. The following hash calculations are supported:
34
* MD5
4-
* SHA1
5-
* SHA224
6-
* SHA256
7-
* SHA3
8-
* SHA384
9-
* SHA512
5+
* SHA-1
6+
* SHA-224
7+
* SHA-256
8+
* SHA-3
9+
* SHA-384
10+
* SHA-512
1011
* CRC32
1112

1213
## About
14+
1315
This library is maintained by CodeDead. You can find more about us using the following links:
1416
* [Website](https://codedead.com)
1517
* [Twitter](https://twitter.com/C0DEDEAD)

app/build.gradle

+16-12
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 29
5-
buildToolsVersion '29.0.2'
4+
compileSdkVersion 30
5+
buildToolsVersion '30.0.2'
66
defaultConfig {
77
applicationId "com.codedead.deadhash"
8-
minSdkVersion 21
9-
targetSdkVersion 29
10-
versionName '1.7.2'
8+
minSdkVersion 24
9+
targetSdkVersion 30
10+
versionName '1.7.3'
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
12-
versionCode 3
12+
versionCode 4
1313
}
1414
buildTypes {
1515
release {
@@ -19,17 +19,21 @@ android {
1919
}
2020
productFlavors {
2121
}
22+
compileOptions {
23+
sourceCompatibility JavaVersion.VERSION_1_8
24+
targetCompatibility JavaVersion.VERSION_1_8
25+
}
2226
}
2327

2428
dependencies {
2529
implementation fileTree(include: ['*.jar'], dir: 'libs')
26-
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
30+
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
2731
exclude group: 'com.android.support', module: 'support-annotations'
2832
})
29-
implementation 'androidx.appcompat:appcompat:1.1.0'
30-
implementation 'com.google.android.material:material:1.0.0'
31-
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
32-
testImplementation 'junit:junit:4.12'
33+
implementation 'androidx.appcompat:appcompat:1.2.0'
34+
implementation 'com.google.android.material:material:1.2.1'
35+
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
36+
testImplementation 'junit:junit:4.13.1'
3337
implementation 'androidx.cardview:cardview:1.0.0'
34-
implementation "androidx.preference:preference:1.1.0"
38+
implementation "androidx.preference:preference:1.1.1"
3539
}

app/src/main/java/com/codedead/deadhash/domain/interfaces/hashgenerator/IHashResponse.java

-11
This file was deleted.

app/src/main/java/com/codedead/deadhash/domain/objects/hashgenerator/FileHashGenerator.java

-25
This file was deleted.

app/src/main/java/com/codedead/deadhash/domain/objects/hashgenerator/HashGenerator.java

+10-12
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
package com.codedead.deadhash.domain.objects.hashgenerator;
22

3-
import android.os.AsyncTask;
4-
5-
import com.codedead.deadhash.domain.interfaces.hashgenerator.IHashResponse;
63
import com.codedead.deadhash.domain.utils.HashUtil;
74

85
import java.io.File;
@@ -11,14 +8,12 @@
118
import java.util.ArrayList;
129
import java.util.List;
1310

14-
public abstract class HashGenerator extends AsyncTask<Void, Void, List<HashData>> {
11+
public final class HashGenerator {
1512

16-
private byte[] data;
13+
private final byte[] data;
1714
private final List<HashAlgorithm> hashAlgorithms;
1815
private final List<HashData> hashData;
19-
private String compare;
20-
21-
public IHashResponse hashResponse = null;
16+
private final String compare;
2217

2318
/**
2419
* Initialize a new HashGenerator
@@ -27,7 +22,7 @@ public abstract class HashGenerator extends AsyncTask<Void, Void, List<HashData>
2722
* @param hashAlgorithms The List of HashingAlgorithm enums that should be used to calculate hashes
2823
* @param compare The compare String for the calculated hashes
2924
*/
30-
HashGenerator(final byte[] data, final List<HashAlgorithm> hashAlgorithms, final String compare) {
25+
public HashGenerator(final byte[] data, final List<HashAlgorithm> hashAlgorithms, final String compare) {
3126
hashData = new ArrayList<>();
3227
this.data = data;
3328

@@ -43,7 +38,7 @@ public abstract class HashGenerator extends AsyncTask<Void, Void, List<HashData>
4338
* @param compare The compare String for the calculated hashes
4439
* @throws IOException When the File could not be read
4540
*/
46-
HashGenerator(final File data, final List<HashAlgorithm> hashAlgorithms, final String compare) throws IOException {
41+
public HashGenerator(final File data, final List<HashAlgorithm> hashAlgorithms, final String compare) throws IOException {
4742
hashData = new ArrayList<>();
4843
this.data = readFileToBytes(data);
4944
this.hashAlgorithms = hashAlgorithms;
@@ -76,8 +71,11 @@ private byte[] readFileToBytes(final File file) throws IOException {
7671
return bytes;
7772
}
7873

79-
@Override
80-
protected List<HashData> doInBackground(Void... params) {
74+
/**
75+
* Generate the List of HashData for the given input data
76+
* @return The List of HashData for the given input data
77+
*/
78+
public final List<HashData> generateHashes() {
8179
for (final HashAlgorithm algorithm : hashAlgorithms) {
8280
switch (algorithm) {
8381
case md5:

app/src/main/java/com/codedead/deadhash/domain/objects/hashgenerator/TextHashGenerator.java

-22
This file was deleted.

app/src/main/java/com/codedead/deadhash/domain/utils/DataAdapter.java

+6-9
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,12 @@ static class DataHolder extends RecyclerView.ViewHolder implements View.OnClickL
7474
final ImageButton copyData = v.findViewById(R.id.Copy_Data);
7575

7676
copyData.setOnClickListener(this);
77-
compareData.setOnClickListener(new View.OnClickListener() {
78-
@Override
79-
public void onClick(final View v) {
80-
if (originalCompare == null || originalCompare.length() == 0) return;
81-
if (originalCompare.equals(encryptionData.getText().toString())) {
82-
Toast.makeText(v.getContext(), R.string.toast_hash_match, Toast.LENGTH_SHORT).show();
83-
} else {
84-
Toast.makeText(v.getContext(), R.string.toast_hash_mismatch, Toast.LENGTH_SHORT).show();
85-
}
77+
compareData.setOnClickListener(v1 -> {
78+
if (originalCompare == null || originalCompare.length() == 0) return;
79+
if (originalCompare.equals(encryptionData.getText().toString())) {
80+
Toast.makeText(v1.getContext(), R.string.toast_hash_match, Toast.LENGTH_SHORT).show();
81+
} else {
82+
Toast.makeText(v1.getContext(), R.string.toast_hash_mismatch, Toast.LENGTH_SHORT).show();
8683
}
8784
});
8885
}

0 commit comments

Comments
 (0)