Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6633647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:50:15+00:00 2026-05-25T22:50:15+00:00

I’m working on a project where user have to login first in application to

  • 0

I’m working on a project where user have to login first in application to use it. And my little problem is that when user enter his username and password, than I have to hash them and send to the server instead of username and password entered by the user. So for now I’m doing something like this :

EditText txtUserName = (EditText) findViewById (R.id.username_login_input);
EditText txtPassword = (EditText) findViewById (R.id.password_login_input);

HttpClient httpclient;
HttpPost httppost;
ArrayList<NameValuePair> postParameters;
httpclient = new DefaultHttpClient();
httppost = new HttpPost("http://www.rpc.shalqlqlq.com");

postParameters = new ArrayList<NameValuePair>();
postParameters.add(new BasicNameValuePair("username_hash", hashUser(txtUserName.getText().toString(),txtPassword.getText().toString())));
postParameters.add(new BasicNameValuePair("password_hash", hashPass(txtUserName.getText().toString(),txtPassword.getText().toString())));

httppost.setEntity(new UrlEncodedFormEntity(postParameters));
HttpResponse response = httpclient.execute(httppost);
Log.w("Response ","Status line : "+ response.getStatusLine().toString());
byte[] buffer = new byte[1024];
buffer = EntityUtils.toString(response.getEntity()).getBytes();

public String hashUser(String username, String password) throws NoSuchAlgorithmException, UnsupportedEncodingException{
String hashUser = SHA1.Sha1Hash(username);
    String hashPass = SHA1.Sha1Hash(password);
    String luser = hashPass+hashUser;
    String lastUser = SHA1.Sha1Hash(luser);
    return lastUser;
}

public String hashPass(String username, String password) throws NoSuchAlgorithmException, UnsupportedEncodingException{
String hashUser = SHA1.Sha1Hash(username);
    String hashPass = SHA1.Sha1Hash(password);
    String lpass = hashPass+hashUser;        
    String lastPass = SHA1.Sha1Hash(lpass);
    return lastPass;
}

And it still tells me that username and password are incorrect. I’m pretty sure that hashing is correct because I’ve already tried it. So can anybody help me to find out where is my mistake ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T22:50:15+00:00Added an answer on May 25, 2026 at 10:50 pm

    If everything is ok, I guess maybe the problem is in getting the username and password from edittext.Try to put

    postParameters.add(new BasicNameValuePair("username_hash", hashUser(txtUserName.getText().toString(),txtPassword.getText().toString())));
    postParameters.add(new BasicNameValuePair("password_hash", hashPass(txtUserName.getText().toString(),txtPassword.getText().toString())));
    

    in some kind of event. I guess you have a button Login..so you set these params on onClick method and I think it will work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.