A simple question about md5 hashing in php [Solved]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
David3
Forum Newbie
Posts: 2
Joined: Fri Aug 12, 2011 10:24 am

A simple question about md5 hashing in php [Solved]

Post by David3 »

Hi all. I'm a newbie in php. what i need to do is to do md5 hashing on some hex values. for example:
I wanna do an md5 hash of 0x14. the actual hash of that, is:
15f41a2e96bae341dde485bb0e78f485
but i can not reproduce that in php.

md5 (0x14); Doesnt work
even md5(chr(hexdec(14))); doesnt work. cause its not an actual character

I tried every possibility that i could think of. none of them gave me the right hash
How can i make this work? its really essential for me
Thanks in advance
Best Regards
David
Last edited by David3 on Fri Aug 12, 2011 12:31 pm, edited 1 time in total.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: A simple question about md5 hashing in php. please help

Post by Celauran »

Code: Select all

hash('md5', chr('0x14'))
David3
Forum Newbie
Posts: 2
Joined: Fri Aug 12, 2011 10:24 am

Re: A simple question about md5 hashing in php. please help

Post by David3 »

Damn. it works. thank you man :) you saved my day

Best Regards
David
Post Reply