These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: PITFALL: MD5 and VARCHAR(31)
PostPosted: Wed May 11, 2005 3:08 am 
Beginner
Beginner

Joined: Fri Apr 29, 2005 10:57 pm
Posts: 41
This was the problem of the century.

I keep all my passwords in MD5, and today I was making some modification to my app after reading Hibernate in Action. When looking at my password field I thought "hmm, why have this as 255 chars - nobody uses passwords that big, I'll take it down to 31".

What I was forgetting is that my passwords are stored in MD5 and not cleartext... And what I also didn't know at the time was that MD5 hashes are exactly 32 characters long.

Looking at logs I could figure out WHY 2 EXACTLY SAME hashes don't pass the one.equals(another) test... I was thinking there was a problem with Java or something...

Well, turned out they were NOT equal. DB was truncating the last character. To add to the complexity of the problem, I had caching set up for one minute, which kept all 32 chars. So it was hell trying to figure out why the hell it works half the time and the other half - it doesn't.

My mother suggested it was the jews, but I proved her wrong.


Top
 Profile  
 
 Post subject: Re: PITFALL: MD5 and VARCHAR(31)
PostPosted: Wed May 11, 2005 4:19 am 
Regular
Regular

Joined: Tue Nov 23, 2004 7:42 am
Posts: 82
Location: London, England
Lasek wrote:
My mother suggested it was the jews, but I proved her wrong.


I'm sure this was meant in jest but it's actually pretty shocking. I suggest not making any more similar jokes. Some people are more easily offended than myself.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 11, 2005 4:25 am 
Beginner
Beginner

Joined: Fri Apr 29, 2005 10:57 pm
Posts: 41
Heh, sorry didn't mean to affend anyone.

It's just that today I found this website tshirthell.com where they had a t shirt that said something like

HITLER
*picture of hitler*
(small font:)love him or hate him but Hitler killed a ton of jews

which I thought was hilarious. I really don't think most jews are offended by jew jokes, I've only heard complaints and "I'm offended" from people who aren't jews.. And I have many jewish friends (I'm half jew myself)

So, if you're a jew and you were offended - get a sense of humor, if you aren't a jew and you were offended - get a life.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.