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

New Free Tools on Dev Shed!
We're Excited to announce that Dev Shed now has 70 free tools on the site. To learn more, click here!

 Dev Shed Forums Sponsor:
#1
December 23rd, 2003, 10:08 PM
 Volitics
Contributing User

Join Date: Oct 2002
Posts: 372
Time spent in forums: < 1 sec
Reputation Power: 12
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.

#2
December 24th, 2003, 01:17 PM
 dog135
Doggie

Join Date: Jul 2003
Location: Seattle, WA
Posts: 751
Time spent in forums: 10 h 38 m 25 sec
Reputation Power: 12
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

#3
December 24th, 2003, 01:23 PM
 Volitics
Contributing User

Join Date: Oct 2002
Posts: 372
Time spent in forums: < 1 sec
Reputation Power: 12
dog135;

Thank you for the help.

#4
September 5th, 2005, 06:42 AM
 _kalle_
Registered User

Join Date: Sep 2005
Posts: 1
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

#5
October 21st, 2009, 08:25 AM
 branneman
Registered User

Join Date: Oct 2009
Posts: 1
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.

 Viewing: Dev Shed Forums > Programming Languages - More > Software 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 Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Please select one User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home -------------------- Programming Languages    PHP Development        PHP FAQs and Stickies    Perl Programming        Perl FAQs and Stickies    C Programming        C Programming FAQs and Stickies    Java Help        Java FAQs    Python Programming        Python Programming FAQs    Ruby Programming        Ruby Programming FAQs    Game Development        Game Development FAQs Programming Languages - More    ASP Programming        ASP Programming FAQs    .Net Development        .Net Development FAQs    Visual Basic Programming        Visual Basic Programming FAQs    Software Design        Software Design FAQs    ColdFusion Development        ColdFusion Development FAQs    Delphi Programming        Delphi Programming FAQs    Regex Programming        Regex Programming FAQs    XML Programming        XML Programming FAQs    Other Programming Languages        Other Programming Languages FAQs Web Design    HTML Programming        HTML Programming FAQs    JavaScript Development        JavaScript Development FAQs    CSS Help        CSS Help FAQs    Flash Help        Flash Help FAQs    Photoshop Help        Photoshop Help FAQs    Web Design Help        Web Design Help FAQs    Website Critiques        Website Critiques FAQs    Search Engine Optimization        Search Engine Optimization FAQs Mobile Programming    Mobile Programming        Mobile Programming FAQs    iPhone SDK Development        iPhone SDK Development FAQs    Android Development        Android Development FAQs    BlackBerry Development        BlackBerry Development FAQs Web Site Management    Business Help        Business Help FAQs    Development Software        Development Software FAQs    Scripts        Scripts FAQs Databases    Database Management        Database Management FAQs    DB2 Development        DB2 Development FAQs    MySQL Help        MySQL Help FAQs    PostgreSQL Help        PostgreSQL Help FAQs    Firebird SQL Development        Firebird SQL Development FAQs    MS SQL Development        MS SQL Development FAQs    Oracle Development        Oracle Development FAQs    LDAP Programming        LDAP Programming FAQs System Administration    Mail Server Help        Mail Server Help FAQs    Apache Development        Apache Development FAQs    Security and Cryptography        Security and Cryptography FAQs    Antivirus Protection        Antivirus Protection FAQs    DNS        DNS FAQs    IIS        IIS FAQs    Networking Help        Networking Help FAQs    FTP Help        FTP Help FAQs Operating Systems    BSD Help        BSD Help FAQs    Linux Help        Linux Help FAQs    UNIX Help        UNIX Help FAQs    Windows Help        Windows Help FAQs    Mac Help        Mac Help FAQs Web Hosting    Web Hosting        Web Hosting FAQs    Free Web Hosting        Free Web Hosting FAQs    Web Hosting Requests        Web Hosting Requests FAQs    Web Hosting Offers        Web Hosting Offers FAQs Computer Hardware    Computer Hardware    CPUs        CPUs FAQs    Cooling        Cooling FAQs    Embedded Programming        Embedded Programming FAQs    Motherboards        Motherboards FAQs    Multimedia Hardware        Multimedia Hardware FAQs Other    Dev Shed Lounge        Dev Shed Lounge FAQs    Development Articles        Development Articles FAQs    Beginner Programming        Beginner Programming FAQs    Hire A Programmer        Hire A Programmer FAQs    Project Help Wanted        Project Help Wanted FAQs Latest News Updated Hourly    Technology News    Business News    Science News Forum Information    Forum Rules/Guidelines        Forum Rules/Guidelines FAQs    Forum Announcements        Forum Announcements FAQs    Dev Shed Gaming Center        Go to the Dev Shed Battle Arena        Go to the Dev Shed Arcade Games        Go to the Legend of the Green Dragon    Suggestions & Feedback        Suggestions & Feedback FAQs

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