473,386 Members | 1,741 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

password encode and decode ?

Jay
Hi everybody !

I've used the "crypt()" function in PHP to save password of a user
logging in a web-based system. Based on a book that I've read (PHP
advanced by Larry UllMan), there is no way that we can recover
(decode) the password once it is encrypted.

Is there any other ways that I can still encrypt a password, save it
in the database and still able to see it later (instead of a string of
junk) ?

PS: the reason I am writing this question is because I like to write a
feature that will e-mail the user his/her password to his/her e-mail
if he/she doesn't remember the password to log in the system.

Any help would be greatly appreciated !!!!

Jay
Jul 17 '05 #1
9 10288
Jay wrote:
Is there any other ways that I can still encrypt a password, save it
in the database and still able to see it later (instead of a string of
junk) ?

PS: the reason I am writing this question is because I like to write a
feature that will e-mail the user his/her password to his/her e-mail
if he/she doesn't remember the password to log in the system.


Instead of mailing the current password, create a new random password
and save it encrypted to the database.

When the user next logs on, he will be able to change the password to
something s/he likes better.

--
USENET would be a better place if everybody read: : mail address :
http://www.catb.org/~esr/faqs/smart-questions.html : is valid for :
http://www.netmeister.org/news/learn2quote2.html : "text/plain" :
http://www.expita.com/nomime.html : to 10K bytes :
Jul 17 '05 #2
If you can decrypt it, then what would be the point of encrypting it.

If your user forgets their password, set a new one, send an email to the
email address you have stored for them, request they login with the new
password and change it.

You can either send the new password in plain text or follow a link from the
email which will auto log them in.
"Jay" <ar********@yahoo.com> wrote in message
news:56*************************@posting.google.co m...
Hi everybody !

I've used the "crypt()" function in PHP to save password of a user
logging in a web-based system. Based on a book that I've read (PHP
advanced by Larry UllMan), there is no way that we can recover
(decode) the password once it is encrypted.

Is there any other ways that I can still encrypt a password, save it
in the database and still able to see it later (instead of a string of
junk) ?

PS: the reason I am writing this question is because I like to write a
feature that will e-mail the user his/her password to his/her e-mail
if he/she doesn't remember the password to log in the system.

Any help would be greatly appreciated !!!!

Jay

Jul 17 '05 #3
If you want details of a reversible encryption routine for PHP then take a
look at http://www.tonymarston.net/php-mysql/encryption.html.

--
Tony Marston

http://www.tonymarston.net
"Jay" <ar********@yahoo.com> wrote in message
news:56*************************@posting.google.co m...
Hi everybody !

I've used the "crypt()" function in PHP to save password of a user
logging in a web-based system. Based on a book that I've read (PHP
advanced by Larry UllMan), there is no way that we can recover
(decode) the password once it is encrypted.

Is there any other ways that I can still encrypt a password, save it
in the database and still able to see it later (instead of a string of
junk) ?

PS: the reason I am writing this question is because I like to write a
feature that will e-mail the user his/her password to his/her e-mail
if he/she doesn't remember the password to log in the system.

Any help would be greatly appreciated !!!!

Jay

Jul 17 '05 #4
Jay
Thanks for everybody's helps !!!

I got the idea !

Jay
Jul 17 '05 #5
Just to say... If you guys really want to learn about programming from a
'real' programmer please visit the Tony Marton site.

Thanks a lot Tony

"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message
news:c7*******************@news.demon.co.uk...
If you want details of a reversible encryption routine for PHP then take a
look at http://www.tonymarston.net/php-mysql/encryption.html.

--
Tony Marston

http://www.tonymarston.net
"Jay" <ar********@yahoo.com> wrote in message
news:56*************************@posting.google.co m...
Hi everybody !

I've used the "crypt()" function in PHP to save password of a user
logging in a web-based system. Based on a book that I've read (PHP
advanced by Larry UllMan), there is no way that we can recover
(decode) the password once it is encrypted.

Is there any other ways that I can still encrypt a password, save it
in the database and still able to see it later (instead of a string of
junk) ?

PS: the reason I am writing this question is because I like to write a
feature that will e-mail the user his/her password to his/her e-mail
if he/she doesn't remember the password to log in the system.

Any help would be greatly appreciated !!!!

Jay


Jul 17 '05 #6
Pedro Graca <he****@hotpop.com> wrote in message news:<c7************@ID-203069.news.uni-berlin.de>...
Jay wrote:
<snip>
Instead of mailing the current password, create a new random password
and save it encrypted to the database.


I vouch Pedro and it is the good practice. If the passwords can be
decrypted, you _may_ not be able to get privacy certifications for
example <http://www.truste.org/>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #7
You are missing the point. These passwords are encrypted when being written
to the database and have nothing to do with encrypting passwords between the
client browser and the server. As both the database and PHP are server-side,
not client-side, it does not matter what encryption algorithm it uses, or if
it offers a decryption routine. These passwords are only visible to people
who have access to the database on the server, but if these passwords are
encrypted then that is an extra level of security at the server end.

--
Tony Marston

http://www.tonymarston.net

"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in message
news:ab**************************@posting.google.c om...
Pedro Graca <he****@hotpop.com> wrote in message

news:<c7************@ID-203069.news.uni-berlin.de>...
Jay wrote:


<snip>
Instead of mailing the current password, create a new random password
and save it encrypted to the database.


I vouch Pedro and it is the good practice. If the passwords can be
decrypted, you _may_ not be able to get privacy certifications for
example <http://www.truste.org/>

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com

Jul 17 '05 #8
[Top-post fixed]

"Tony Marston" <to**@NOSPAM.demon.co.uk> wrote in message news:<c7*******************@news.demon.co.uk>...
"R. Rajesh Jeba Anbiah" <ng**********@rediffmail.com> wrote in message
news:ab**************************@posting.google.c om...
I vouch Pedro and it is the good practice. If the passwords can be
decrypted, you _may_ not be able to get privacy certifications for
example <http://www.truste.org/>

You are missing the point. These passwords are encrypted when being written
to the database and have nothing to do with encrypting passwords between the
client browser and the server. As both the database and PHP are server-side,
not client-side, it does not matter what encryption algorithm it uses, or if
it offers a decryption routine. These passwords are only visible to people
who have access to the database on the server, but if these passwords are
encrypted then that is an extra level of security at the server end.


I was talking about the privacy and the right practice... If the
encrypted password that is stored in db can be decrypted by the site
admin, you lose your privacy. For the right privacy requirement, your
password should not be accessible/decrypted *even* by the site admin.

--
| Just another PHP saint |
Email: rrjanbiah-at-Y!com
Jul 17 '05 #9
Tony Marston <to**@nospam.demon.co.uk> wrote:
You are missing the point. These passwords are encrypted when being
written to the database and have nothing to do with encrypting
passwords between the client browser and the server. As both the
database and PHP are server-side, not client-side, it does not matter
what encryption algorithm it uses, or if it offers a decryption
routine.
This is not what the OP was asking about. He was clearly asking how to
decrypt a password inorder to sent it by email to a user.
These passwords are only visible to people who
have access to the database on the server, but if these passwords are
encrypted then that is an extra level of security at the server end.


Sending a decrypted password to users adds extra vulnerabilities, a user
might have the same password on other systems. So if someone can fool
the application to send the old password it's potentially more dangerous
than sending a new random password.

--

Daniel Tryba

Jul 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Lobang Trader | last post by:
Hi all, I am trying to create a username and a password class. I would like to know what are the RECOMMENDED minimum and maximum length for both fields? These fields will be something like...
4
by: Newbie | last post by:
How would I modify this form to encode *all* the characters in the 'source' textarea to the '%xx' format & place result code into the 'output' textarea? (cross browser compatable) Any help is...
1
by: Damir Hakimov | last post by:
Hi *! I found a strange bug in base64.encode and decode, when I try to encode - decode a file 1728512 bytes lenth. Is somebody meet with this? I don't attach the file because it big, but can...
1
by: AR | last post by:
I would like to know more about the Encode/Decode feature available within MS Access. This is what I have read from Microsoft Office OnLine: "The simplest method of protection is to encode the...
20
by: _mario.lat | last post by:
hallo, I use PHP and I'd like to not write in hardcoded way password and login to access to mysql. how to not write password in code for access to mysql? How can I do? I'd like that who see my...
6
by: 7stud | last post by:
s1 = "hello" s2 = s1.encode("utf-8") s1 = "an accented 'e': \xc3\xa9" s2 = s1.encode("utf-8") The last line produces the error: --- Traceback (most recent call last):
13
by: mario | last post by:
Hello! i stumbled on this situation, that is if I decode some string, below just the empty string, using the mcbs encoding, it succeeds, but if I try to encode it back with the same encoding it...
4
by: J Peyret | last post by:
Well, as usual I am confused by unicode encoding errors. I have a string with problematic characters in it which I'd like to put into a postgresql table. That results in a postgresql error so I...
1
by: anonymous | last post by:
1 Objective to write little programs to help me learn German. See code after numbered comments. //Thanks in advance for any direction or suggestions. tk 2 Want keyboard answer input, for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.