If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Storing md5 of ID's

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-27-06, 01:27
jezemine jezemine is offline
another indirection layer
 
Join Date: May 2004
Location: Seattle
Posts: 1,312
what exactly are you protecting if you do this? it seems to me you are only exchanging a small number for a much bigger number, and also introducing a heavy perf cost to your query. I don't see any benefit.
__________________
elsasoft.org
Reply With Quote
  #2 (permalink)  
Old 11-27-06, 02:27
sco08y sco08y is offline
Registered User
 
Join Date: Oct 2002
Location: Baghdad, Iraq
Posts: 697
The only thing I can see you gaining by using a hash of the ID is so that user 5 can't say "hm, I think I'll log on as user 6."

If you need to obscure logins, generate a session id each time they log in, and store the login credentials in the session table. You can also store a random number in the session table to prevent someone from hijacking someone else's session. (The random number really doesn't need to be bigger than 32 bits...) None of this requires any MD5 stuff. (BTW, MD5 is obsolete. Use SHA256 if possible.)
Reply With Quote
  #3 (permalink)  
Old 11-27-06, 07:23
djuritz djuritz is offline
Registered User
 
Join Date: Sep 2005
Posts: 67
That's a great idea!

You're right: the idea is not let users know their users id's.
I'm like to add a new table and generate random integers for every session.

Thanks!
Diego.-


Quote:
Originally Posted by sco08y
The only thing I can see you gaining by using a hash of the ID is so that user 5 can't say "hm, I think I'll log on as user 6."

If you need to obscure logins, generate a session id each time they log in, and store the login credentials in the session table. You can also store a random number in the session table to prevent someone from hijacking someone else's session. (The random number really doesn't need to be bigger than 32 bits...) None of this requires any MD5 stuff. (BTW, MD5 is obsolete. Use SHA256 if possible.)
Reply With Quote
  #4 (permalink)  
Old 11-27-06, 10:27
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
...and why in the world would you want to use "LIKE 'c4ca4238a0b923820dcc509a6f75849b'" anyway? Better take a few minutes and refresh yourself on the use of the LIKE operator.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
  #5 (permalink)  
Old 11-27-06, 15:28
Brett Kaiser Brett Kaiser is offline
Window Washer
 
Join Date: Nov 2002
Location: Jersey
Posts: 10,303
I like X002548, personally

in what platform are you doing this?
__________________
Brett
8-)

It's a Great Day for America everybody!

dbforums Yak CorralRadio 'Rita
dbForums Member List
I'm Good Once as I ever was

The physical order of data in a database has no meaning.
Reply With Quote
  #6 (permalink)  
Old 11-30-06, 11:10
djuritz djuritz is offline
Registered User
 
Join Date: Sep 2005
Posts: 67
Hi.

What's wrong using LIKE ?
I know it's better to use ID (it's smaller). However, the idea behind this is not to let users known their id's.

Thanks..

Quote:
Originally Posted by blindman
...and why in the world would you want to use "LIKE 'c4ca4238a0b923820dcc509a6f75849b'" anyway? Better take a few minutes and refresh yourself on the use of the LIKE operator.
Reply With Quote
  #7 (permalink)  
Old 11-30-06, 11:11
blindman blindman is offline
World Class Flame Warrior
 
Join Date: Jun 2003
Location: Ohio
Posts: 11,726
You didn't use any wildcards in your LIKE statement. It was equivalent to an "equals" comparison.
__________________
If it's not practically useful, then it's practically useless.

blindman
www.chess.com: "sqlblindman"
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On