Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: OT: Is MD5 ALWAYS 32 character long?

by l3nz (Friar)
on Dec 18, 2003 at 13:42 UTC ( [id://315514]=note: print w/replies, xml ) Need Help??


in reply to OT: Is MD5 ALWAYS 32 character long?

I believe that, as the 32 byte string you see is the textual encoding of a 128 bit (16 bytes) binary string, it will consistently hold the same length no matter what the binary content will be.

About CHAR or VARCHAR, it depends. It's usually better to use a CHAR because in most implementations a VARCHAR will require one more page fetch per string read because VARCHAR data will be stored in a separate disk table, but if you plan to access one row at a time and you will fetch that row from an index seek, the performance cost will be quite small anyway. On the other side, I would not routinely query a one million row database with a LIKE statement on a VARCHAR.... :-)

A number of SQL implementations (mySQL for one) don't support mixed CHAR / VARCHAR fields in the same row, so if you change one field to VARCHAR all other CHARs will be converted to VARCHAR. So beware!

Please note that whether you say CHAR(32) or VARCHAR(32), only the first 32 chars will be stored in the database.

  • Comment on Re: OT: Is MD5 ALWAYS 32 character long?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://315514]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (4)
As of 2024-04-23 23:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found