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 7722667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T04:14:31+00:00 2026-06-01T04:14:31+00:00

I am creating a program that communicates with a PHP script on a web

  • 0

I am creating a program that communicates with a PHP script on a web server and to do so I need to be able to pass parameters from the program to the PHP script.

Now here is my question. At some point the user name and password needs to be passed to the script. Now this is not done in a way that is apparent to users (such as in an address bar) but I know with a little sniffing around someone that really wanted to could figure it out. So while my script is safe from injection, obviously variable tampering is an issue here.

This is an idea I have come up with so please help me wrap my head around it and see if this would work the way I THINK it will.

My thought was to encrypt the user password (or another unique key) variables on the client side before sending so you get a url like (obviously just made up) mypage.php?un=Oa348uty8&ps=op986hGTfreu Then when it gets to the PHP script decrypt it and encrypt it again with a different salt.

So when it leaves the application it would be encrypted but not the correct way, and then when it hits the PHP script server side decrypt it and re-encrypt it with the correct salt so it would correctly match the stored encrypted password.

This way, they user would not know what the encrypted version of their password is supposed to look like so without that they would not be able to tamper with the URL and try to insert fake values.

  • 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-06-01T04:14:32+00:00Added an answer on June 1, 2026 at 4:14 am

    To put it in a nutshell, you are thinking of this:

    On server side you have:

    • a database, with login/password matches.
    • a script that take 2 parameters (password and username) and check in the database if the couple exists

    Your problem:

    When your local application call the php script on server side, the 2 parameters are given in plain text. And you want to avoid tampering ( if your script are safe against injection i only see tampering used to bruteforce the auth <= keep in mind that i will keep this assumption in the whole post)

    Your solution:

    • On client side, encrypt the 2 parameters
    • On server side, add a salt in your script to salt
    • Then decrypt the 2 parameters and encrypt with a salt

    What I think:

    This will not solve the tampering issue, someone can still forge requests.
    The first encryption is useless because someone can retreive the key used by your client.
    The second encryption is not safe enought because you use the same salt for all you users.

    What I suggest:

    Accept that tampering can’t be avoided if you don’t use a secure protocol like HTTPS (can either use SSL or TLS).
    If you want an acceptable security without HTTPS the following is what i would implement:

    • A token system that you will check in order to see if the user can perform the login operation
    • A username that would not be encrypted
    • The password sha1 hashed stored in database
    • On client side, you call the script and provide the username as non encrypted and your password as a sha1 hash, rehashed with a random salt (sha1(sha1(pass)+salt) (the salt is stored in the user session on server side)
    • The script would then compared the provided hash with db password hash rehashed with session salt

    The improvement is that the attacker must try to brute force two sha1 passwords consecutivaly and must provide a valid token to perform the login action. Plus if you use as salt a string using hex char of a variable even length, it will make the job harder for the attacker to recognised that the value bruteforced by the second hash is a sha1 hash, and even if he know it’s an sha1 he will have to test multiple case to try to find the right portion of the value that correspond to the hash.

    Because of variable salt, a same password won’t be the same if hashed:
    Imagine the attacker sniffed a hash and know which password was used then sniff another hash that was made with the same password as the other, the attacker won’t be able to know that the 2 password where the same( a little overkill but still usefull).

    It is safer to store the password as hashed value, because if the attacker manage to dump your user table, he won’t be able to use the passwords right away, he would have to bruteforce each of then.
    Finally sha1 hash are safer than md5 (i tell you that because you used the md5 tag in your post)

    The downside of this method is that passwords can’t be reversed, so you won’t be able to given them back to your users if they lost it. You will have to make them set a new one.

    An hardcore way (still without using HTTPS), would be to encrypt your password and username with a strong cypher (like AES or 3DES) and use a secure key echange algorythm (like the Diffie Hellman one) to exchange a random shared key.

    This method won’t block tampering, but will screw the attacker, because he won’t be able to decrypt the value (assuming he only is sniffing the network). The key is random and never hardcoded in any of your application, so even if someone reverse your client, he won’t be able to retreive a key.
    I would still recommend to store your password value has hash.

    An extreme way would be to merge the 2 methods but would be completly overkill.

    Hope this will give you ideas

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

Sidebar

Related Questions

I'm creating a program that gets data from a server using AJAX/JSON and then
I'd like to play with the idea of creating a server program that communicates
I'm creating a program that authenticates from a before it runs. I also want
I am creating a client program that talks to a server (which I programmed).
I am creating a program that will fill in a given grammar. Right now
I'm creating a program that communicates with a webservice, which is written with JSP
I am creating a program that will download a .jar (java) file from a
everyone: Im creating a program that is able to create Matrices and and perform
I am currently creating a program that dynamically adds Image to a dockPanel every
When creating DLL files for a program that already exists, is it customary to

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.