LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2008, 01:36 AM   #1
slackermax
LQ Newbie
 
Registered: Jul 2008
Posts: 14

Rep: Reputation: 0
I have a silly mysql problem... what am i doing wrong?


i am trying to 'retrieve' passwords. I know that you don't retrieve but rather test against what's in the db. The username and password are both 'test'. However, I cannot query the db with:
select * from members where password=sha1('test');
and get anything other than an empty set.

The server is MySQL 5.0

Code:
mysql> select * from members;
+-----+-------+------------+-----------+--------+------+-----------------+-------+------------+-----------+---------+--------+
| uid | uname | first_name | last_name | cemail | plan | password        | level | regdate    | squestion | sanswer | active |
+-----+-------+------------+-----------+--------+------+-----------------+-------+------------+-----------+---------+--------+
|   7 | test  | test       | test      | test   | test | a94a8fe5ccb19ba |       | 2008-09-20 |           |         |        |
+-----+-------+------------+-----------+--------+------+-----------------+-------+------------+-----------+---------+--------+
1 row in set (0.00 sec)

mysql> select * from members where password=sha1('test');
max.
Empty set (0.00 sec)

Last edited by slackermax; 09-20-2008 at 01:37 AM. Reason: added the code tags.
 
Old 09-20-2008, 01:45 AM   #2
elprawn
Member
 
Registered: Feb 2005
Distribution: Gentoo 2008
Posts: 138

Rep: Reputation: 15
The sha1 is 40 characters long. Your password field is too short and is cutting off a large portion of the key.
 
Old 09-20-2008, 10:03 AM   #3
slackermax
LQ Newbie
 
Registered: Jul 2008
Posts: 14

Original Poster
Rep: Reputation: 0
that was it exactly thank you very much...
IDK how i got a charlength of 15 in that field. It was supposed to be 50.
 
  


Reply

Tags
mysql



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
next button-silly problem awcomeon Linux - Newbie 1 09-14-2008 12:52 PM
Silly question...that received no answeres or searching wrong place dbiswas_slg Linux - Newbie 2 10-12-2006 03:26 AM
Silly sata problem tlann75 Linux - Hardware 2 06-09-2005 07:42 PM
Very silly DNS Problem thebalance Linux - Networking 2 09-30-2004 02:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration