Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do a md5 hash of some hex values?

Tags:

php

hex

md5

I'm a newbie in php. what i need to do is to do md5 hashing on some hex values. For example, I want to do an md5 hash of 0x14. the actual hash of that, is:

15f41a2e96bae341dde485bb0e78f485

but i can not reproduce that in PHP.

md5 (0x14);

Doesn't work, even

md5(chr(hexdec(14)));

doesn't work. cause its not an actual character

I tried every possibility that i could think of, searched countless hours on the Internet, still nothing. How can i make this work?

like image 656
Hamy Avatar asked Dec 22 '22 10:12

Hamy


1 Answers

php> echo md5(chr(0x14))
15f41a2e96bae341dde485bb0e78f485
like image 179
Dogbert Avatar answered Dec 24 '22 02:12

Dogbert