Hello as you can see below I m trying to make a (android) app which check md5 hash of file this code works only for small files can someone help me?
final TextView informations = (TextView) findViewById(R.id.Informations);
final EditText input = (EditText) findViewById(R.id.ToCrack);
String filepath = data.getDataString();
String rawtext;
String hash;
StringBuilder text = new StringBuilder();
filepath = filepath.split("//")[1];
File file = new File(filepath);
Toast.makeText(getApplicationContext(),"Loading: "+filepath,Toast.LENGTH_LONG).show();
FileInputStream fis = null;
BufferedInputStream bis = null;
DataInputStream dis = null;
try{
fis = new FileInputStream(file);
bis = new BufferedInputStream(fis);
dis = new DataInputStream(bis);
while (dis.available() != 0){
text.append(dis.readLine()+"\n");
}
}
catch (IOException e){
e.printStackTrace();
}
finally {
try{
fis.close();
bis.close();
dis.close();
}
catch (IOException ex){
ex.printStackTrace();
}
}
rawtext = text.toString().substring(0, text.length()-1);
hash = new MD5(rawtext).hexdigest();
if (hash.equals(input.getText().toString())){
informations.setText("Hash correspond with the file!");
}
else{
informations.setText("File hash= "+hash+"\nHashes does not correspond :(");
}
Toast.makeText(getApplicationContext(),"Copied file hash to clipboard.",Toast.LENGTH_LONG).show();