Edward Posted August 11, 2012 Share Posted August 11, 2012 I found out the the VARBINARY(32) for the pass field is wrong and should be VARBINARY(64), i was just making my log in page and it was not working due to this small error. SHA256 needs 64, 32 is only half of its output. Link to comment Share on other sites More sharing options...
Antonio Conte Posted August 11, 2012 Share Posted August 11, 2012 Dude. Stop making new threads like these. A thread should have discussion potential, or at least be a question, not just stating information. If you asked for other peoples tricks/secrets/etc, there would be discussion potential, but there's really non here. This would be a viable post in a general DB/mysql thread, but not a thread in itself. 1 Link to comment Share on other sites More sharing options...
Edward Posted August 11, 2012 Author Share Posted August 11, 2012 Sorry are you trying to help me, really I wasn't aware if I was doing something wrong. I got stuck for 1 hour that's why I posted this up. Link to comment Share on other sites More sharing options...
Antonio Conte Posted August 11, 2012 Share Posted August 11, 2012 My post was merely meant to help you. Sorry if you feel stepped on. The problem is; how does this thread spark discussion? How does it enable me to be a participant in the conversation? Good threads always makes this possible. They have a defined topic that lets users discuss and exchange experiences. You can share your experiences, but broaden the topic and let others contribute to the thread. You'll see you'll get much more replies on your threads this way. And that's kind of the point, right? Creating discussions? Just my two cents. 2 Link to comment Share on other sites More sharing options...
Edward Posted August 11, 2012 Author Share Posted August 11, 2012 Okay I see your point next time I will make an open question, so everyone can answer. 1 Link to comment Share on other sites More sharing options...
Edward Posted August 15, 2012 Author Share Posted August 15, 2012 So does anyone know why a sha256 needs 64 characters to store in the database as VARBINARY? And 32 is not enough? How many Varbinary would we also need if we wanted to store a SHA512 so i can compare your reasoning, anyone have any insights on this one? Link to comment Share on other sites More sharing options...
Antonio Conte Posted August 15, 2012 Share Posted August 15, 2012 Make a script of this. It will allow you to see hash lengths for all hashes. <?php $data = "password"; foreach (hash_algos() as $v) { $r = hash($v, $data, false); printf("%-12s %3d %s\n", $v, strlen($r), $r); } ?> sha512 requires 512 chars for hashes. You may notice this is the double of sha256. 32 chars for sha256 is simply not enough as it produces larger hashes. More than that, I don't know. Link to comment Share on other sites More sharing options...
Recommended Posts