├── app ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── colors.xml │ │ │ │ ├── dimens.xml │ │ │ │ ├── styles.xml │ │ │ │ └── strings.xml │ │ │ ├── mipmap-mdpi │ │ │ │ ├── icon.png │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── icon.png │ │ │ │ └── ic_launcher.png │ │ │ ├── values-ca │ │ │ │ └── strings.xml │ │ │ ├── values-es │ │ │ │ └── strings.xml │ │ │ ├── layout-v24 │ │ │ │ └── activity_main.xml │ │ │ ├── layout-v26 │ │ │ │ └── activity_main.xml │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── misker │ │ │ │ └── mike │ │ │ │ └── hasher │ │ │ │ ├── MainView.java │ │ │ │ ├── hashers │ │ │ │ ├── Hasher.java │ │ │ │ ├── SHA1Hasher.java │ │ │ │ ├── SHA256Hasher.java │ │ │ │ ├── SHA384Hasher.java │ │ │ │ ├── SHA512Hasher.java │ │ │ │ ├── MD5Hasher.java │ │ │ │ ├── CRC32Hasher.java │ │ │ │ ├── Adler32Hasher.java │ │ │ │ └── HasherFactory.java │ │ │ │ ├── FixedTabsPagerAdapter.java │ │ │ │ ├── PageFragment.java │ │ │ │ ├── HashRunnable.java │ │ │ │ └── Main.java │ │ └── AndroidManifest.xml │ └── test │ │ └── java │ │ └── com │ │ └── misker │ │ └── mike │ │ └── hasher │ │ ├── ExampleUnitTest.java │ │ └── hashers │ │ ├── CRC32HasherTest.java │ │ ├── Adler32HasherTest.java │ │ ├── MD5HasherTest.java │ │ ├── SHA1HasherTest.java │ │ ├── SHA256HasherTest.java │ │ ├── SHA384HasherTest.java │ │ ├── SHA512HasherTest.java │ │ └── HasherFactoryTest.java ├── proguard-rules.pro ├── google-services.json └── build.gradle ├── settings.gradle ├── _config.yml ├── google3e55dc2a2cebcd0c.html ├── google-play-badge.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── LICENSE ├── .travis.yml ├── gradlew.bat ├── keybase.txt ├── README.md └── gradlew /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /google3e55dc2a2cebcd0c.html: -------------------------------------------------------------------------------- 1 | google-site-verification: google3e55dc2a2cebcd0c.html -------------------------------------------------------------------------------- /google-play-badge.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/google-play-badge.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/app/src/main/res/mipmap-mdpi/icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/app/src/main/res/mipmap-xxhdpi/icon.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Miskerest/Hashr/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | ./app/build.gradle 10 | ./app/release 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/MainView.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher; 2 | 3 | interface MainView { 4 | void displayWaitProgress(); 5 | void displayResults(String results); 6 | } 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 16dp 4 | 16dp 5 | 6 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | 6 | public interface Hasher { 7 | String hash(InputStream inputStream) throws IOException; 8 | } 9 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sun Nov 17 10:22:05 EST 2019 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/SHA1Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | public class SHA1Hasher implements Hasher { 10 | public String hash(InputStream inputStream) throws IOException { 11 | return new String(Hex.encodeHex(DigestUtils.sha1(inputStream))); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/SHA256Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | class SHA256Hasher implements Hasher { 10 | @Override 11 | public String hash(InputStream inputStream) throws IOException { 12 | return new String(Hex.encodeHex(DigestUtils.sha256(inputStream))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/SHA384Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | class SHA384Hasher implements Hasher { 10 | @Override 11 | public String hash(InputStream inputStream) throws IOException { 12 | return new String(Hex.encodeHex(DigestUtils.sha384(inputStream))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/SHA512Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | class SHA512Hasher implements Hasher { 10 | @Override 11 | public String hash(InputStream inputStream) throws IOException { 12 | return new String(Hex.encodeHex(DigestUtils.sha512(inputStream))); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.assertEquals; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/MD5Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.codec.binary.Hex; 4 | import org.apache.commons.codec.digest.DigestUtils; 5 | 6 | import java.io.InputStream; 7 | 8 | public class MD5Hasher implements Hasher { 9 | public String hash(String stringToHash) { 10 | return new String(Hex.encodeHex(DigestUtils.md5(stringToHash))); 11 | } 12 | 13 | public String hash(InputStream inputStream) { 14 | return new String(Hex.encodeHex(DigestUtils.md5(inputStream.toString()))); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/CRC32HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class CRC32HasherTest { 13 | @Test 14 | public void shouldCreateCRC32Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher crc32Hasher = new CRC32Hasher(); 17 | String hashedString = crc32Hasher.hash(inputStream); 18 | assertThat(hashedString, is("6beb4e6e")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/Adler32HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class Adler32HasherTest { 13 | @Test 14 | public void shouldCreateCRC32Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher adler32Hasher = new Adler32Hasher(); 17 | String hashedString = adler32Hasher.hash(inputStream); 18 | assertThat(hashedString, is("49420733")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/MD5HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class MD5HasherTest { 13 | @Test 14 | public void shouldCreateAnMD5Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher md5Hasher = new MD5Hasher(); 17 | String hashedString = md5Hasher.hash(inputStream); 18 | assertThat(hashedString, is("b5ad53c085f0d402334689101351d842")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/SHA1HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class SHA1HasherTest { 13 | @Test 14 | public void shouldCreateSHA1Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher sha1Hasher = new SHA1Hasher(); 17 | String hashedString = sha1Hasher.hash(inputStream); 18 | assertThat(hashedString, is("473cc856cae3bd89e43ff9f62963d6f38372ccbd")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/SHA256HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class SHA256HasherTest { 13 | 14 | @Test 15 | public void shouldCreateSHA256Hash() throws IOException { 16 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 17 | Hasher sha256Hasher = new SHA256Hasher(); 18 | String hashedString = sha256Hasher.hash(inputStream); 19 | assertThat(hashedString, is("ea83a45637a9af470a994d2c9722273ef07d47aec0660a1d10afe6e9586801ac")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in C:\Users\Mike\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -keep class com.google.android.gms.** { ; } -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/SHA384HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class SHA384HasherTest { 13 | @Test 14 | public void shouldCreateSHA384Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher sha384Hasher = new SHA384Hasher(); 17 | String hashedString = sha384Hasher.hash(inputStream); 18 | assertThat(hashedString, is("d32d6343ac065ff185abd04a2f54d1f825d51f4c9af1ee181fd6e7b1042f577fe19f2817c39ddeda52cdc31c0cd0195d")); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | android.enableJetifier=true 13 | android.useAndroidX=true 14 | org.gradle.jvmargs=-Xmx2048m 15 | 16 | # When configured, Gradle will run in incubating parallel mode. 17 | # This option should only be used with decoupled projects. More details, visit 18 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 19 | # org.gradle.parallel=true 20 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/CRC32Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.zip.CRC32; 6 | import java.util.zip.CheckedInputStream; 7 | 8 | class CRC32Hasher implements Hasher { 9 | @Override 10 | public String hash(InputStream inputStream) { 11 | byte[] buffer = new byte[128]; 12 | try (CheckedInputStream cis = new CheckedInputStream(inputStream, new CRC32())) { 13 | //noinspection StatementWithEmptyBody 14 | while (cis.read(buffer) >= 0) ; 15 | long checksum = cis.getChecksum().getValue(); 16 | return Long.toHexString(checksum); 17 | } catch (IOException ioe) { 18 | throw new RuntimeException("There was a problem reading the CheckedInputStream for the CRC32 algorithm", ioe); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/SHA512HasherTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.io.IOUtils; 4 | import org.junit.Test; 5 | 6 | import java.io.IOException; 7 | import java.io.InputStream; 8 | 9 | import static org.hamcrest.CoreMatchers.is; 10 | import static org.junit.Assert.assertThat; 11 | 12 | public class SHA512HasherTest { 13 | @Test 14 | public void shouldCreateSHA512Hash() throws IOException { 15 | InputStream inputStream = IOUtils.toInputStream("some string to hash"); 16 | Hasher sha512Hasher = new SHA512Hasher(); 17 | String hashedString = sha512Hasher.hash(inputStream); 18 | //noinspection SpellCheckingInspection 19 | assertThat(hashedString, is("921d459060ff11fcf3bcd72dfdc37361abe43695bece7f2f71ddae0f3048df7fcec9c850f264a0ea2ccd1aa1e022be322a0f6d720c683240c141b704e2063a30")); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/Adler32Hasher.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import java.io.IOException; 4 | import java.io.InputStream; 5 | import java.util.zip.Adler32; 6 | import java.util.zip.CheckedInputStream; 7 | 8 | class Adler32Hasher implements Hasher { 9 | @Override 10 | public String hash(InputStream inputStream) { 11 | byte[] buffer = new byte[128]; 12 | try (CheckedInputStream cis = new CheckedInputStream(inputStream, new Adler32())) { 13 | //noinspection StatementWithEmptyBody 14 | while (cis.read(buffer) >= 0) ; 15 | long checksum = cis.getChecksum().getValue(); 16 | return Long.toHexString(checksum); 17 | } catch (IOException ioe) { 18 | throw new RuntimeException("There was a problem reading the CheckedInputStream for the Adler32 algorithm", ioe); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/hashers/HasherFactory.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | public class HasherFactory { 4 | 5 | public static Hasher createHasher(String hasherType) { 6 | Hasher hasher; 7 | switch (hasherType) { 8 | case "MD5": 9 | hasher = new MD5Hasher(); 10 | break; 11 | case "SHA1": 12 | hasher = new SHA1Hasher(); 13 | break; 14 | case "SHA256": 15 | hasher = new SHA256Hasher(); 16 | break; 17 | case "SHA384": 18 | hasher = new SHA384Hasher(); 19 | break; 20 | case "Adler32": 21 | hasher = new Adler32Hasher(); 22 | break; 23 | case "CRC32b": 24 | hasher = new CRC32Hasher(); 25 | break; 26 | 27 | default: 28 | hasher = new SHA512Hasher(); 29 | } 30 | return hasher; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hashr 3 | Compare Hashes… 4 | HASH 5 | Please wait… 6 | Text to hash 7 | Select file 8 | Hashes match! 9 | Hashes don\'t match. 10 | Clipboard empty. 11 | FILE 12 | TEXT 13 | 14 | 15 | MD5 16 | SHA1 17 | SHA256 18 | SHA384 19 | SHA512 20 | CRC32b 21 | Adler32 22 | 23 | 24 | ca-app-pub-5863757662079397/8723627780 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/values-ca/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hashr 3 | Compara resums… 4 | Crea resum 5 | Espereu… 6 | Text a crear resum 7 | Seleccioneu un fitxer 8 | Els resums coincideixen! 9 | Els resums no coincideixen 10 | El porta-retalls està buit 11 | FITXER 12 | TEXT 13 | 14 | 15 | MD5 16 | SHA1 17 | SHA256 18 | SHA384 19 | SHA512 20 | CRC32b 21 | Adler32 22 | 23 | 24 | ca-app-pub-5863757662079397/8723627780 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/values-es/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Hashr 3 | Comparar resúmenes… 4 | Calcular resumen 5 | Espere… 6 | Texto a crear resumen 7 | Seleccione un archivo 8 | ¡Los resúmenes coinciden! 9 | Los resúmenes no coinciden. 10 | El portapapeles está vacío. 11 | ARCHIVO 12 | TEXTO 13 | 14 | 15 | MD5 16 | SHA1 17 | SHA256 18 | SHA384 19 | SHA512 20 | CRC32b 21 | Adler32 22 | 23 | 24 | ca-app-pub-5863757662079397/8723627780 25 | 26 | 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Mike Bailey 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: android 2 | jdk: oraclejdk8 3 | 4 | before_cache: 5 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock 6 | - rm -fr $HOME/.gradle/caches/*/plugin-resolution/ 7 | cache: 8 | directories: 9 | - $HOME/.gradle/caches/ 10 | - $HOME/.gradle/wrapper/ 11 | 12 | android: 13 | components: 14 | # Uncomment the lines below if you want to 15 | # use the latest revision of Android SDK Tools 16 | - tools 17 | - platform-tools 18 | - tools 19 | - build-tools-25.0.1 20 | - android-23 21 | - add-on 22 | - extra-android-m2repository 23 | licenses: 24 | - android-sdk-preview-license-52d11cd2 25 | - android-sdk-license-c81a61d9 26 | - android-sdk-license-.+ 27 | - google-gdk-license-.+ 28 | 29 | script: 30 | - ./gradlew build connectedCheck --stacktrace 31 | 32 | before_install: 33 | - "chmod +x gradlew" 34 | 35 | #before_script: 36 | # - echo no | android create avd --force -n test -t android-23 --abi armeabi-v7a 37 | # - emulator -avd test -no-skin -no-audio -no-window & 38 | # - android-wait-for-emulator 39 | # - adb shell input keyevent 82 & 40 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/FixedTabsPagerAdapter.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher; 2 | 3 | import android.content.Context; 4 | 5 | import androidx.fragment.app.Fragment; 6 | import androidx.fragment.app.FragmentManager; 7 | import androidx.fragment.app.FragmentPagerAdapter; 8 | 9 | /** 10 | * Created by Mike on 3/3/17. 11 | * Supporting class for paginated main activity 12 | */ 13 | 14 | class FixedTabsPagerAdapter extends FragmentPagerAdapter { 15 | 16 | private Context context; 17 | 18 | FixedTabsPagerAdapter(FragmentManager fm) { 19 | super(fm); 20 | } 21 | 22 | void setContext(Context context){ 23 | this.context = context; 24 | } 25 | 26 | @Override 27 | public Fragment getItem(int position) { 28 | return PageFragment.newInstance(position + 1); 29 | } 30 | 31 | @Override 32 | public int getCount() { 33 | return 2; 34 | } 35 | 36 | @Override 37 | public CharSequence getPageTitle(int position) { 38 | 39 | if (position == 1) { 40 | return context.getResources().getString(R.string.TEXT); 41 | } 42 | return context.getResources().getString(R.string.FILE); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/PageFragment.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher; 2 | 3 | import android.os.Bundle; 4 | import android.view.LayoutInflater; 5 | import android.view.View; 6 | import android.view.ViewGroup; 7 | import android.widget.TextView; 8 | 9 | import java.util.Locale; 10 | 11 | import androidx.annotation.NonNull; 12 | import androidx.fragment.app.Fragment; 13 | 14 | /** 15 | * Created by Mike on 3/3/17. 16 | * Supporting class for paginated main activity 17 | */ 18 | 19 | public class PageFragment extends Fragment { 20 | 21 | private static final String ARG_PAGE_NUMBER = "page_number"; 22 | 23 | public PageFragment() { 24 | } 25 | 26 | static PageFragment newInstance(int page) { 27 | PageFragment fragment = new PageFragment(); 28 | Bundle args = new Bundle(); 29 | args.putInt(ARG_PAGE_NUMBER, page); 30 | fragment.setArguments(args); 31 | return fragment; 32 | } 33 | 34 | @Override 35 | public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, 36 | Bundle savedInstanceState) { 37 | View rootView = inflater.inflate(R.layout.activity_main, container, false); 38 | int page; 39 | TextView txt = new TextView(getActivity()); 40 | 41 | try { 42 | //noinspection ConstantConditions 43 | page = getArguments().getInt(ARG_PAGE_NUMBER, -1); 44 | } 45 | catch (java.lang.NullPointerException e) { 46 | page = -1; 47 | } 48 | 49 | txt.setText(String.format(Locale.getDefault(), "Page %d", page)); 50 | return rootView; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /app/src/test/java/com/misker/mike/hasher/hashers/HasherFactoryTest.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher.hashers; 2 | 3 | import org.apache.commons.lang3.RandomStringUtils; 4 | import org.junit.Test; 5 | 6 | import static org.hamcrest.CoreMatchers.is; 7 | import static org.junit.Assert.assertThat; 8 | 9 | public class HasherFactoryTest { 10 | 11 | @Test 12 | public void shouldCreateAdler32hasher() { 13 | Hasher hasher = HasherFactory.createHasher("Adler32"); 14 | assertThat(hasher.getClass().getTypeName(), is(Adler32Hasher.class.getTypeName())); 15 | } 16 | 17 | @Test 18 | public void shouldCreateCRC32hasher() { 19 | Hasher hasher = HasherFactory.createHasher("CRC32b"); 20 | assertThat(hasher.getClass().getTypeName(), is(CRC32Hasher.class.getTypeName())); 21 | } 22 | 23 | @Test 24 | public void shouldCreateMD5hasher() { 25 | Hasher hasher = HasherFactory.createHasher("MD5"); 26 | assertThat(hasher.getClass().getTypeName(), is(MD5Hasher.class.getTypeName())); 27 | } 28 | 29 | @Test 30 | public void shouldCreateSHA1hasher() { 31 | Hasher hasher = HasherFactory.createHasher("SHA1"); 32 | assertThat(hasher.getClass().getTypeName(), is(SHA1Hasher.class.getTypeName())); 33 | } 34 | 35 | @Test 36 | public void shouldCreateSHA256hasher() { 37 | Hasher hasher = HasherFactory.createHasher("SHA256"); 38 | assertThat(hasher.getClass().getTypeName(), is(SHA256Hasher.class.getTypeName())); 39 | } 40 | 41 | @Test 42 | public void shouldCreateSHA384hasher() { 43 | Hasher hasher = HasherFactory.createHasher("SHA384"); 44 | assertThat(hasher.getClass().getTypeName(), is(SHA384Hasher.class.getTypeName())); 45 | } 46 | 47 | @Test 48 | public void shouldCreateSHA512hasherByDefault() { 49 | String hashType = RandomStringUtils.random(15); 50 | Hasher hasher = HasherFactory.createHasher(hashType); 51 | assertThat(hasher.getClass().getTypeName(), is(SHA512Hasher.class.getTypeName())); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 9 | 10 | 11 | 12 | 15 | 16 | 19 | 20 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 46 | 47 | 48 | 49 | 50 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /app/google-services.json: -------------------------------------------------------------------------------- 1 | { 2 | "project_info": { 3 | "project_number": "1032919479906", 4 | "firebase_url": "https://hasher-f47a2.firebaseio.com", 5 | "project_id": "hasher-f47a2", 6 | "storage_bucket": "hasher-f47a2.appspot.com" 7 | }, 8 | "client": [ 9 | { 10 | "client_info": { 11 | "mobilesdk_app_id": "1:1032919479906:android:3009fe2463f54ba2", 12 | "android_client_info": { 13 | "package_name": "com.example.mike.hasher" 14 | } 15 | }, 16 | "oauth_client": [ 17 | { 18 | "client_id": "1032919479906-9ng3bjuholjb7mh07o99tgcf266tlon1.apps.googleusercontent.com", 19 | "client_type": 1, 20 | "android_info": { 21 | "package_name": "com.example.mike.hasher", 22 | "certificate_hash": "76b5934800470d0b2dd3c57d66a7d8a6ad849641" 23 | } 24 | }, 25 | { 26 | "client_id": "1032919479906-fje9v2ajc3vpjra25irhksug0c862k92.apps.googleusercontent.com", 27 | "client_type": 3 28 | } 29 | ], 30 | "api_key": [ 31 | { 32 | "current_key": "AIzaSyDcMRy4l-4zqYp6efGUGkRK2mk-gsfAkeM" 33 | } 34 | ], 35 | "services": { 36 | "analytics_service": { 37 | "status": 1 38 | }, 39 | "appinvite_service": { 40 | "status": 2, 41 | "other_platform_oauth_client": [ 42 | { 43 | "client_id": "1032919479906-fje9v2ajc3vpjra25irhksug0c862k92.apps.googleusercontent.com", 44 | "client_type": 3 45 | } 46 | ] 47 | }, 48 | "ads_service": { 49 | "status": 2 50 | } 51 | } 52 | }, 53 | { 54 | "client_info": { 55 | "mobilesdk_app_id": "1:1032919479906:android:a990d6a2e8e7718f", 56 | "android_client_info": { 57 | "package_name": "com.misker.mike.hasher" 58 | } 59 | }, 60 | "oauth_client": [ 61 | { 62 | "client_id": "1032919479906-fje9v2ajc3vpjra25irhksug0c862k92.apps.googleusercontent.com", 63 | "client_type": 3 64 | } 65 | ], 66 | "api_key": [ 67 | { 68 | "current_key": "AIzaSyDcMRy4l-4zqYp6efGUGkRK2mk-gsfAkeM" 69 | } 70 | ], 71 | "services": { 72 | "analytics_service": { 73 | "status": 1 74 | }, 75 | "appinvite_service": { 76 | "status": 1, 77 | "other_platform_oauth_client": [] 78 | }, 79 | "ads_service": { 80 | "status": 2 81 | } 82 | } 83 | } 84 | ], 85 | "configuration_version": "1" 86 | } -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /app/src/main/java/com/misker/mike/hasher/HashRunnable.java: -------------------------------------------------------------------------------- 1 | package com.misker.mike.hasher; 2 | 3 | import android.content.ContentResolver; 4 | import android.net.Uri; 5 | import android.os.AsyncTask; 6 | import android.util.Log; 7 | 8 | import com.misker.mike.hasher.hashers.Hasher; 9 | import com.misker.mike.hasher.hashers.HasherFactory; 10 | 11 | import java.io.ByteArrayInputStream; 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | import java.nio.charset.StandardCharsets; 15 | import java.util.Objects; 16 | 17 | 18 | /** 19 | * Created by Mike Bailey on 12/9/16. 20 | * Class for calculating hashes of Strings or file-like objects 21 | */ 22 | 23 | class HashRunnable extends AsyncTask { 24 | 25 | private final MainView mainView; 26 | private final String type; 27 | private String toHash; 28 | private ContentResolver cr; 29 | 30 | 31 | HashRunnable(String hashtype, ContentResolver cr, MainView mainView){ 32 | type = hashtype; 33 | this.cr = cr; 34 | this.mainView = mainView; 35 | } 36 | 37 | HashRunnable(String hashtype, String toHash, MainView mainView){ 38 | type = hashtype; 39 | this.toHash = toHash; 40 | this.mainView = mainView; 41 | } 42 | 43 | @Override 44 | public void onPreExecute() { 45 | mainView.displayWaitProgress(); 46 | } 47 | 48 | @Override 49 | public void onPostExecute(String result) { 50 | mainView.displayResults(result); 51 | } 52 | 53 | @Override 54 | protected String doInBackground(Uri... uris) { 55 | String output = "Nice job buddy, you broke my code!"; 56 | if(cr != null) { 57 | try { 58 | InputStream is = cr.openInputStream(uris[0]); 59 | 60 | if(is == null) 61 | throw new IOException(); 62 | 63 | output = createHash(type, is); 64 | } catch (IOException e) { 65 | Log.e("FileDebug", Objects.requireNonNull(e.getMessage())); 66 | } 67 | } else { 68 | try { 69 | InputStream is = new ByteArrayInputStream(toHash.getBytes(StandardCharsets.UTF_8)); 70 | output = createHash(type, is); 71 | } 72 | catch (IOException e){ 73 | Log.e("FileDebug", Objects.requireNonNull(e.getMessage())); 74 | } 75 | } 76 | 77 | return output; 78 | } 79 | 80 | private String createHash(String hasherType, InputStream inputStream) throws IOException { 81 | Hasher hasher = HasherFactory.createHasher(hasherType); 82 | return hasher.hash(inputStream); 83 | } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /keybase.txt: -------------------------------------------------------------------------------- 1 | ================================================================== 2 | https://keybase.io/misker 3 | -------------------------------------------------------------------- 4 | 5 | I hereby claim: 6 | 7 | * I am an admin of https://hashr.pw 8 | * I am misker (https://keybase.io/misker) on keybase. 9 | * I have a public key with fingerprint F8CB 82D3 F5DD F588 3B9F F4D8 B2BC 3C95 9A50 70FE 10 | 11 | To do so, I am signing this object: 12 | 13 | { 14 | "body": { 15 | "key": { 16 | "eldest_kid": "010110a2eb5c73319754067d132ff1d02e0b887684e4a333010947ca92b9e0dbde1c0a", 17 | "fingerprint": "f8cb82d3f5ddf5883b9ff4d8b2bc3c959a5070fe", 18 | "host": "keybase.io", 19 | "key_id": "b2bc3c959a5070fe", 20 | "kid": "010110a2eb5c73319754067d132ff1d02e0b887684e4a333010947ca92b9e0dbde1c0a", 21 | "uid": "351ba891580b01fd958df935239bd419", 22 | "username": "misker" 23 | }, 24 | "service": { 25 | "hostname": "hashr.pw", 26 | "protocol": "https:" 27 | }, 28 | "type": "web_service_binding", 29 | "version": 1 30 | }, 31 | "ctime": 1523054465, 32 | "expire_in": 157680000, 33 | "prev": "6168b924b5412b4c2ae4b01aee476b3e76fb90248519966fe384e054957f9954", 34 | "seqno": 91, 35 | "tag": "signature" 36 | } 37 | 38 | which yields the signature: 39 | 40 | -----BEGIN PGP MESSAGE----- 41 | Version: Keybase OpenPGP v2.0.76 42 | Comment: https://keybase.io/crypto 43 | 44 | yMInAnicrVJbSBVBGF4tS63QUiPCLi49ZFns7Ozs7pzooatdkOzykFEddnZnj9vx 45 | nD3t7tE0rU5YopBGRUn11JXIwm7Qk3Y92gUpsCgKoqyoh6SELhJFs2JvPTYvw/zz 46 | fd//fT//nXEjuMyUVxOTfH7pu2kpD24eiHMbur4ntvPENqr5wHY+TIcuWmFQ1wuG 47 | LYMP8AIQABA0kRKkKxACrCBJkBUDQNE0gSGIVCCqqsiqRCUNQsjwWFJ0DYsEU8Eg 48 | BgW6oPFFvGlFQ9SJOVbUY7KmqhNVNKCJDMNEqgoJNk3JUIlIdKhjhDUkKIJJGbHc 49 | dn0GM0c0l861bFZjj+CQvX/g/7Pv+JAcRIBoKgZIFYgATAMj1TAxRCLExJAA9oEu 50 | daJahDJ0xHLD1OHrinhWq7R06o/VzzH8X6655c7cWBVjxRzbs3W7wq96XswN+Cyv 51 | OubDqigJDgsEiRU12AQZo5I6rmVH+QBgSN2zfEXAjAhIkmRUxNNtMcuhQctHIBZQ 52 | YMfvQyuZpAxklWBRIkgCIpF0UaMSC6RRKikygVSRTYIFUVIRwFiWTQrZgJgyRoqJ 53 | MZJ4P9LWqM0HMGA+tRDTdK1QVPPiDuXrbt3YOJJLyeRGpaX6q8VlZmT/XbhDY9O5 54 | 1trJqYWRjpk9J7K3DBwKXct78fjujOo335yGZOka8fi5l0uyTg9cHFxS8LpvGVE+ 55 | F56uiqH1s6+3l/1QrzzJuV88/XZJw+GGtQf7EotKe0edLym+1HJyR2L1nsCkL1+z 56 | 9O72xJTnV7vSJvzqPLvr5ouaU60j3D3eVzVj1o1PC/aPjzVxhd2Ta5cPwoKps7Ny 57 | c7i2xrXhC1XRlcf27czdvTfSRGD8+7P+moLQ7+Y1H9zWxpp7/YtzIuWpOH1TcsU6 58 | NLrdOboq0jIQOpDVWwbf9m35eWRzTWHGyPeB/Pkfpa4x787WdzzckSiof/qI23C5 59 | PykvXRiw56nxOelncrJ72vKmdDb/AeitNfs= 60 | =uo6E 61 | -----END PGP MESSAGE----- 62 | 63 | And finally, I am proving ownership of this host by posting or 64 | appending to this document. 65 | 66 | View my publicly-auditable identity here: https://keybase.io/misker 67 | 68 | ================================================================== 69 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | dependencies { 4 | implementation fileTree(include: ['*.jar'], dir: 'libs') 5 | androidTestImplementation('androidx.test.espresso:espresso-core:3.2.0', { 6 | exclude group: 'com.android.support', module: 'support-annotations' 7 | }) 8 | implementation 'commons-codec:commons-codec:1.10' 9 | implementation 'commons-io:commons-io:2.4' 10 | implementation 'com.google.firebase:firebase-core:17.2.1' 11 | implementation 'com.google.firebase:firebase-ads:18.3.0' 12 | implementation 'org.kie.modules:org-apache-commons-lang3:6.5.0.Final' 13 | 14 | 15 | implementation "com.android.support:design" 16 | implementation 'androidx.browser:browser:1.0.0' 17 | implementation 'androidx.appcompat:appcompat:1.1.0' 18 | implementation 'androidx.appcompat:appcompat:1.1.0' 19 | implementation 'com.google.android.material:material:1.0.0' 20 | implementation 'androidx.vectordrawable:vectordrawable:1.1.0' 21 | // VectorDrawableCompat 22 | implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0' 23 | // AnimatedVectorDrawableCompat 24 | implementation 'androidx.percentlayout:percentlayout:1.0.0' 25 | implementation 'androidx.transition:transition:1.2.0' 26 | implementation 'androidx.annotation:annotation:1.1.0' 27 | 28 | implementation 'com.jakewharton:butterknife:10.2.0' 29 | annotationProcessor 'com.jakewharton:butterknife-compiler:10.2.0' 30 | testImplementation 'junit:junit:4.12' 31 | } 32 | 33 | android { 34 | compileSdkVersion 29 35 | compileOptions { 36 | sourceCompatibility JavaVersion.VERSION_1_8 37 | targetCompatibility JavaVersion.VERSION_1_8 38 | } 39 | defaultConfig { 40 | applicationId "com.misker.mike.hasher" 41 | minSdkVersion 19 42 | targetSdkVersion 29 43 | maxSdkVersion 29 44 | versionCode 22 45 | versionName "1.3.0" 46 | testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" 47 | vectorDrawables.useSupportLibrary = true 48 | } 49 | buildTypes { 50 | release { 51 | minifyEnabled false 52 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 53 | } 54 | } 55 | packagingOptions { 56 | exclude 'META-INF/DEPENDENCIES.txt' 57 | exclude 'META-INF/LICENSE.txt' 58 | exclude 'META-INF/NOTICE.txt' 59 | exclude 'META-INF/NOTICE' 60 | exclude 'META-INF/LICENSE' 61 | exclude 'META-INF/DEPENDENCIES' 62 | exclude 'META-INF/notice.txt' 63 | exclude 'META-INF/license.txt' 64 | exclude 'META-INF/dependencies.txt' 65 | exclude 'META-INF/LGPL2.1' 66 | } 67 | buildToolsVersion = '29.0.2' 68 | } 69 | 70 | 71 | apply plugin: 'com.google.gms.google-services' -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # About 2 | 3 | I made this app because I tried to download two separate apps from the Play Store to validate a system image's checksum. Neither worked, so I made my own! 4 | 5 | It's designed to be simple, fast, and easy to use. This is my first published Android application, so feedback is appreciated! 6 | 7 | # Installation 8 | 9 | Requires Android 4.4+ 10 | 11 | ### Sources 12 | 13 | * [Google Play](https://play.google.com/store/apps/details?id=com.misker.mike.hasher) 14 | * Pre-compiled apks are under [Releases](https://github.com/Miskerest/Hashr/releases) 15 | * [Amazon App Store](http://a.co/dk4aA1O) 16 | 17 | ### Permissions 18 | 19 | * read the contents of your USB storage 20 | * receive data from Internet 21 | * view network connections 22 | * full network access 23 | * prevent device from sleeping 24 | 25 | # Usage 26 | 1. Select whether you would like to hash a file or raw text. 27 | 2. Open any file or enter text in the text field. 28 | 3. Select the hashing algorithm you would like to use. Click `HASH` and the file's hash will be calculated and printed. 29 | 4. (optional) If you have a reference hash, copy it to your clipboard and click on `Tap to paste...` to compare the two hashes. 30 | 31 | ### Currently has support for 32 | * MD5 33 | * SHA1 34 | * SHA256 35 | * SHA384 36 | * SHA512 37 | * CRC32 38 | * Adler32 39 | 40 | # Future Plans 41 | 42 | * Showing filename for selected file 43 | * A prettier UI, better animations 44 | * Add testing code (In progress) 45 | * Translations for select locales 46 | 47 | Bugfixes are being fixed as they are discovered 48 | 49 | # Screenshots 50 | 51 | 52 | ## License 53 | 54 | The MIT License (MIT) 55 | 56 | Copyright (c) 2016 Mike Bailey 57 | 58 | Permission is hereby granted, free of charge, to any person obtaining a copy 59 | of this software and associated documentation files (the "Software"), to deal 60 | in the Software without restriction, including without limitation the rights 61 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 62 | copies of the Software, and to permit persons to whom the Software is 63 | furnished to do so, subject to the following conditions: 64 | 65 | The above copyright notice and this permission notice shall be included in all 66 | copies or substantial portions of the Software. 67 | 68 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 69 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 70 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 71 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 72 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 73 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 74 | SOFTWARE. 75 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /app/src/main/res/layout-v24/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 14 | 15 | 24 | 25 | 34 | 35 | 36 | 43 | 44 | 49 | 50 | 51 | 63 | 64 | 72 | 73 |