Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 23rd, 2003, 09:08 PM
Volitics Volitics is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 372 Volitics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
How Many Possibilities For (32) - Character Alphanumeric String?

How many possible combinations is there with a thirty-two (32) character string where each character has to be alphanumeric?

If I'm figuring it right, and I'm not at all sure that I am, the answer would be *36 x 36 x 36 .... and so forth for a total of thirty-two multiples.

(i.e. 1-0 and a-z, thirty-six possibilities for each character)*

Using my Lotus 1-2-3 spreadsheet, I get an answer of 6.33402866629733E+049 for the thirty-second calculation. I know it's a larger number but I'm not sure exactly what it means.

The reason that I ask the above is that I'm working on a user registration script for a web site. What I'm wanting to do is assign a unique user id for each user. I am applying the PHP "md5()" function to each registrant's username in order to get a thirty-two character string that I can use as a unique id.

All this is probably a moot point since each username (no two usernames can be alike in my database) will yield a different thirty-two character string when I apply the md5() function to it.

I'm just trying to sort through all of this and think it through in order to minimize the potential for my web site crashing a few months down the road.

Reply With Quote
  #2  
Old December 24th, 2003, 12:17 PM
dog135's Avatar
dog135 dog135 is offline
Doggie
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jul 2003
Location: Seattle, WA
Posts: 751 dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level)dog135 User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 10 h 38 m 25 sec
Reputation Power: 11
36^32 (thirtysix to the power of thirtytwo) is the correct answer. Basically what you did.

When it says "E+" it means, that's how many places you move the decimal over. So roughly:

63340000000000000000000000000000000000000000000000

Big number, huh?

In SQL, for my IDs, I usually use, "id int(6) auto_increment primary key". That'll make an integer that's always unique for each record.

It is possible that two different user names return the same md5 value. But just check the uniqueness based on the md5 and not the name itself, and you should be fine.
__________________
"Science is constructed of facts as a house is of stones. But a collection of facts is no more a science than a heap of stones is a house." - Henri Poincare

Reply With Quote
  #3  
Old December 24th, 2003, 12:23 PM
Volitics Volitics is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 372 Volitics User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 11
dog135;

Thank you for the help.

Reply With Quote
  #4  
Old September 5th, 2005, 05:42 AM
_kalle_ _kalle_ is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 1 _kalle_ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 39 sec
Reputation Power: 0
Okay, I know this is quite old thread but I happend to stumble across this while looking for the amount of possible combinations for a md5 hash. (Okay, so maybe I should have just thought it through and use the calculator to get the answer but google was open on my browser so I just went for it)

So the above answer is correct for a 32-character alphanumeric string but md5 hash is a 32-character hexadecimal number. So there are only 16 possible values (0-9 and a-f) and not 36. Using the same equation as above we get the correct answer which is 16^32 (3,4028236692093846346337460743177e+38)

But that should be enough anyway

Reply With Quote
  #5  
Old October 21st, 2009, 07:25 AM
branneman branneman is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2009
Posts: 1 branneman New User: is a brand new recruit and a unknown entity at this point. 
Time spent in forums: 11 m 37 sec
Reputation Power: 0
To be precise:

for 36 possibilities (a-z & 0-9):
63340286662973277706162286946811886609896461828096

for 16 possibilities (a-f & 0-9):
340282366920938463463374607431768211456

MD5 is the latter, 16 possibilities indeed per character.
Comments on this post
jwdonahue disagrees: You have revived an ancient thread and add nothing of any use to the tribal knowledge.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > How Many Possibilities For (32) - Character Alphanumeric String?

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap