Skip to content

Commit

Permalink
Merge pull request #2 from CodeDead/release/1.7.3
Browse files Browse the repository at this point in the history
Release/1.7.3
  • Loading branch information
CodeDead authored Nov 10, 2020
2 parents 1e5b26d + d7ab006 commit f067a4f
Show file tree
Hide file tree
Showing 13 changed files with 208 additions and 343 deletions.
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
# DeadHash

DeadHash is a freeware utility to calculate file and text hashes. The following hash calculations are supported:
* MD5
* SHA1
* SHA224
* SHA256
* SHA3
* SHA384
* SHA512
* SHA-1
* SHA-224
* SHA-256
* SHA-3
* SHA-384
* SHA-512
* CRC32

## About

This library is maintained by CodeDead. You can find more about us using the following links:
* [Website](https://codedead.com)
* [Twitter](https://twitter.com/C0DEDEAD)
Expand Down
28 changes: 16 additions & 12 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion '29.0.2'
compileSdkVersion 30
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "com.codedead.deadhash"
minSdkVersion 21
targetSdkVersion 29
versionName '1.7.2'
minSdkVersion 24
targetSdkVersion 30
versionName '1.7.3'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
versionCode 3
versionCode 4
}
buildTypes {
release {
Expand All @@ -19,17 +19,21 @@ android {
}
productFlavors {
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', {
androidTestImplementation('androidx.test.espresso:espresso-core:3.3.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.1'
implementation 'androidx.cardview:cardview:1.0.0'
implementation "androidx.preference:preference:1.1.0"
implementation "androidx.preference:preference:1.1.1"
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
package com.codedead.deadhash.domain.objects.hashgenerator;

import android.os.AsyncTask;

import com.codedead.deadhash.domain.interfaces.hashgenerator.IHashResponse;
import com.codedead.deadhash.domain.utils.HashUtil;

import java.io.File;
Expand All @@ -11,14 +8,12 @@
import java.util.ArrayList;
import java.util.List;

public abstract class HashGenerator extends AsyncTask<Void, Void, List<HashData>> {
public final class HashGenerator {

private byte[] data;
private final byte[] data;
private final List<HashAlgorithm> hashAlgorithms;
private final List<HashData> hashData;
private String compare;

public IHashResponse hashResponse = null;
private final String compare;

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

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

@Override
protected List<HashData> doInBackground(Void... params) {
/**
* Generate the List of HashData for the given input data
* @return The List of HashData for the given input data
*/
public final List<HashData> generateHashes() {
for (final HashAlgorithm algorithm : hashAlgorithms) {
switch (algorithm) {
case md5:
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,12 @@ static class DataHolder extends RecyclerView.ViewHolder implements View.OnClickL
final ImageButton copyData = v.findViewById(R.id.Copy_Data);

copyData.setOnClickListener(this);
compareData.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(final View v) {
if (originalCompare == null || originalCompare.length() == 0) return;
if (originalCompare.equals(encryptionData.getText().toString())) {
Toast.makeText(v.getContext(), R.string.toast_hash_match, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(v.getContext(), R.string.toast_hash_mismatch, Toast.LENGTH_SHORT).show();
}
compareData.setOnClickListener(v1 -> {
if (originalCompare == null || originalCompare.length() == 0) return;
if (originalCompare.equals(encryptionData.getText().toString())) {
Toast.makeText(v1.getContext(), R.string.toast_hash_match, Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(v1.getContext(), R.string.toast_hash_mismatch, Toast.LENGTH_SHORT).show();
}
});
}
Expand Down
Loading

0 comments on commit f067a4f

Please sign in to comment.