473,511 Members | 15,156 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

md5 question

I am having problems with using md5 with a password.

I am able to set the password with the md5 coverting what I type into say..
"a87ff679a2f3e71"

I'm writing to the db with the password and the condition by using

-------- pword=md5('$ud_pword')

I am having a problem reading the value from the db after it's set. I use a
form that wants an id and the password to load the record for editing, when
I type "a87ff679a2f3e71" into the form It loads, when I type the password
that I typed in the form that made coverted to "a87ff679a2f3e71" it
doesn't work.

So the password is entered, saved in the db as "a87ff679a2f3e71"

and now I want to relogin with the standard password, without having to type
"a87ff679a2f3e71"
I'm attempting to read the password in my query as follows.

$query="SELECT * FROM contacts WHERE (notid=$serid) and
pword=md5('$serpass')";
*** I altered this query so much, that I'm not sure what I have tired and
not tried, as always I appreciate your efforts and assistance on my many
questions.

Thanks! in advance,


Jul 16 '05 #1
5 3039
The md5 algorithm generates a 32 characters hash. Make sure your
database field can contain those 32 characters, otherwise, it will be
truncated.

entoone wrote:
I am having problems with using md5 with a password.

I am able to set the password with the md5 coverting what I type into say..
"a87ff679a2f3e71"

I'm writing to the db with the password and the condition by using

-------- pword=md5('$ud_pword')

I am having a problem reading the value from the db after it's set. I use a
form that wants an id and the password to load the record for editing, when
I type "a87ff679a2f3e71" into the form It loads, when I type the password
that I typed in the form that made coverted to "a87ff679a2f3e71" it
doesn't work.

So the password is entered, saved in the db as "a87ff679a2f3e71"

and now I want to relogin with the standard password, without having to type
"a87ff679a2f3e71"
I'm attempting to read the password in my query as follows.

$query="SELECT * FROM contacts WHERE (notid=$serid) and
pword=md5('$serpass')";
*** I altered this query so much, that I'm not sure what I have tired and
not tried, as always I appreciate your efforts and assistance on my many
questions.

Thanks! in advance,


Jul 16 '05 #2
entoone wrote:
I am having problems with using md5 with a password.

I am able to set the password with the md5 coverting what I type into say..
"a87ff679a2f3e71"


This doesn't seem to be long enough for a MySQL MD5 - it should be 32
hex characters. Check that the field is long enough.

MK.

--
MeerKat

Jul 16 '05 #3
I did adjust the field from 15 to 32, and then I edited my coding again and
it seemed to work.

I did have to login, change my password, for testing purposes just to the
single character of "4", which made my password the super long string of
characters. I then attempted to re-login in using the 4 as the password and
it let me in.

I did another test with an account that had a password of say "cat", but
when I typed in cat into the password box, it didn't log me in, since I
think it wants all passwords that are currently in the db to be in this
"hash" format right?

1. Do I need to covert the other account passwords? or ??
2. I have an option on the page after you login to allow password changes,
when you see the password it's the
scrambled "hash" version, and not the "4" how can they see their password as
they would understand and not the other version?

Thanks again

"Louis-Philippe Huberdeau" <lp*********@sympatico.ca> wrote in message
news:el*******************@news20.bellglobal.com.. .
The md5 algorithm generates a 32 characters hash. Make sure your
database field can contain those 32 characters, otherwise, it will be
truncated.

entoone wrote:
I am having problems with using md5 with a password.

I am able to set the password with the md5 coverting what I type into say.. "a87ff679a2f3e71"

I'm writing to the db with the password and the condition by using

-------- pword=md5('$ud_pword')

I am having a problem reading the value from the db after it's set. I use a form that wants an id and the password to load the record for editing, when I type "a87ff679a2f3e71" into the form It loads, when I type the password that I typed in the form that made coverted to "a87ff679a2f3e71" it
doesn't work.

So the password is entered, saved in the db as "a87ff679a2f3e71"

and now I want to relogin with the standard password, without having to type "a87ff679a2f3e71"
I'm attempting to read the password in my query as follows.

$query="SELECT * FROM contacts WHERE (notid=$serid) and
pword=md5('$serpass')";
*** I altered this query so much, that I'm not sure what I have tired and not tried, as always I appreciate your efforts and assistance on my many
questions.

Thanks! in advance,

Jul 16 '05 #4
With total disregard for any kind of safety measures "entoone"
<en*****@pacbell.net> leapt forth and uttered:
$query="SELECT * FROM contacts4 WHERE (notid=$serid) and
(pword='$serpass')";


$query="SELECT * FROM contacts4 WHERE notid=$serid and pword=MD5('$serpass')";
--
There is no signature.....
Jul 16 '05 #5
Very good Phil! that works... Thanks for your time.

I am able to read the value from the db now, without having to use clear
text! -- Bravo!

Now onto a script to be able to change the passwords.

"Phil Roberts" <ph*****@HOLYflatnetSHIT.net> wrote in message
news:Xn*************************@216.196.97.132...
With total disregard for any kind of safety measures "entoone"
<en*****@pacbell.net> leapt forth and uttered:
$query="SELECT * FROM contacts4 WHERE (notid=$serid) and
(pword='$serpass')";

$query="SELECT * FROM contacts4 WHERE notid=$serid and

pword=MD5('$serpass')";

--
There is no signature.....

Jul 16 '05 #6

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

Similar topics

1
3083
by: Mohammed Mazid | last post by:
Can anyone please help me on how to move to the next and previous question? Here is a snippet of my code: Private Sub cmdNext_Click() End Sub Private Sub cmdPrevious_Click() showrecord
3
4997
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
7
2629
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
3
3059
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
10
3390
by: glenn | last post by:
I am use to programming in php and the way session and post vars are past from fields on one page through to the post page automatically where I can get to their values easily to write to a...
10
3682
by: Rider | last post by:
Hi, simple(?) question about asp.net configuration.. I've installed ASP.NET 2.0 QuickStart Sample successfully. But, When I'm first start application the follow message shown. ========= Server...
53
4021
by: Jeff | last post by:
In the function below, can size ever be 0 (zero)? char *clc_strdup(const char * CLC_RESTRICT s) { size_t size; char *p; clc_assert_not_null(clc_strdup, s); size = strlen(s) + 1;
56
4696
by: spibou | last post by:
In the statement "a *= expression" is expression assumed to be parenthesized ? For example if I write "a *= b+c" is this the same as "a = a * (b+c)" or "a = a * b+c" ?
2
4252
by: Allan Ebdrup | last post by:
Hi, I'm trying to render a Matrix question in my ASP.Net 2.0 page, A matrix question is a question where you have several options that can all be rated according to several possible ratings (from...
3
2539
by: Zhang Weiwu | last post by:
Hello! I wrote this: ..required-question p:after { content: "*"; } Corresponding HTML: <div class="required-question"><p>Question Text</p><input /></div> <div...
0
7148
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7367
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
7430
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...
1
5072
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.