So I have stored password as hash in shared preferences, when user puts password I need to make a hash of it and compare with stored one.
Should it be done in AsyncTask or Thread because calculation and comparison could freeze UI? And then do you know a clean way to recieve result (true, false) from asynctask or thread?
public void startGenerateCode(View view) {
String pinCompare = pin; //pin is class variable obtained from editText
pinCompare = tools.bin2hex(tools.getHash(pinCompare));
if(pinCompare.compareTo(session.getDetails("Pin"))==0){
generateCode();
}
else
Toast.makeText(this, "Wrong PIN", Toast.LENGTH_SHORT).show();
}
public void generateCode(){
Intent i = new Intent(this, GeneratedCode.class);
startActivity(i);
overridePendingTransition(R.anim.right_slide_in, R.anim.right_slide_out);
finish();
}
This is done in activity after button is pressed.