What is the best way to hash passwords to SHA1 in a mobile java application using SQLite?
Below is how the data is inserted into the database. I want the password to be hashed, preferably in SHA1. It will be used to Login on another page aswell so do i need to do a similar process in that java class?
SignUp.Java
public void onSignUpClick(View v) {
        if (v.getId() == R.id.Bsignupbutton) {
            EditText name = (EditText) findViewById(R.id.TFname);
            EditText email = (EditText) findViewById(R.id.TFemail);
            EditText uname = (EditText) findViewById(R.id.TFuname);
            EditText pass1 = (EditText) findViewById(R.id.TFpass1);
            EditText pass2 = (EditText) findViewById(R.id.TFpass2);
            String namestr = name.getText().toString();
            String emailstr = email.getText().toString();
            String unamestr = uname.getText().toString();
            String pass1str = pass1.getText().toString();
            String pass2str = pass2.getText().toString();
            if (!pass1str.equals(pass2str)) {
                //popup msg
                Toast pass = Toast.makeText(SignUp.this, "Passwords don't match!", Toast.LENGTH_SHORT);
                pass.show();
            } else {
                if (name.getText().toString().length() == 0) {
                    name.setError("Name Required");
                } else if (!email.getText().toString().matches("[a-zA-Z]{1}\\.[a-zA-Z]*[0-9]{4}@student\\.leedsbeckett\\.ac\\.uk")) {
                    email.setError("Incorrect Email Format");
                } else if (!uname.getText().toString().matches("[cC][0-9]{7}")) {
                    uname.setError("Incorrect ID Format");
                } else if (!pass1.getText().toString().matches("(?=.*[\\d])(?=.*[a-z])(?=.*[A-Z]).{8,}")) {
                    pass1.setError("Incorrect Password Format");
                } else {
                    //insert the details in database
                    Contact c = new Contact();
                    c.setName(namestr);
                    c.setEmail(emailstr);
                    c.setUname(unamestr);
                    c.setPass(pass1str);
                    helper.insertContact(c);
                    Toast pass = Toast.makeText(SignUp.this, "User Registered", Toast.LENGTH_LONG);
                    pass.show();
                    Intent i = new Intent(SignUp.this, com.example.oliver.beckettreg.MainActivity.class);
                    startActivity(i);
                }
            }
        }
    }
 
     
     
     
     
    