mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 12:53:55 +01:00
Modify testSHA1() to use InputStream instead of File
This commit is contained in:
parent
d8719d4fcb
commit
03f207db16
1 changed files with 1 additions and 9 deletions
|
|
@ -45,7 +45,7 @@ public class Utils {
|
||||||
|
|
||||||
private static final String TAG = Utils.class.getName();
|
private static final String TAG = Utils.class.getName();
|
||||||
|
|
||||||
public static boolean testSHA1(String sha1, File file) {
|
public static boolean testSHA1(String sha1, InputStream is) {
|
||||||
MessageDigest digest;
|
MessageDigest digest;
|
||||||
try {
|
try {
|
||||||
digest = MessageDigest.getInstance("SHA1");
|
digest = MessageDigest.getInstance("SHA1");
|
||||||
|
|
@ -54,14 +54,6 @@ public class Utils {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
InputStream is;
|
|
||||||
try {
|
|
||||||
is = new FileInputStream(file);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
Log.e(TAG, "Exception while getting FileInputStream", e);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
byte[] buffer = new byte[8192];
|
byte[] buffer = new byte[8192];
|
||||||
int read;
|
int read;
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue