Jump to content

Need help 1 way encrypting passwords.


cooldude832

Recommended Posts

I'm wanting to one way encrypt passwords users enter into my database using the crypt(); function.  However as I read tutorial after tutorial i'm very confused on the syntax of using a salt to ensure you get the same results both ways.  After reading a bit I think baublefish is the best encryption method, but how do I actually write it out.

 

$password = $_REQUEST['password'];
$cryptpassword = crypt($password,??????????);

 

Link to comment
Share on other sites

so sha1 doesn't require a user salt added i can just say:

$password = sha1($_REQUEST['password']);
and then compare
$sql "SELECT * FROM USERS WHERE Password = '$password'";

 

is it secure to passs the password with POST or is there some encryption I should include on my form?

 

Link to comment
Share on other sites

so sha1 doesn't require a user salt added i can just say:

$password = sha1($_REQUEST['password']);
and then compare
$sql "SELECT * FROM USERS WHERE Password = '$password'";

 

is it secure to passs the password with POST or is there some encryption I should include on my form?

 

 

Secure enough as long as you aren't passing credit card information, than you would want an SSH server which would encrypt the data anyhow.

 

But yea, just do not store the un-encrypted password in the session or the cookie. Anytime you reference that password in code it should be verifying it with the encrypted version, do that and you will be alright.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.