PHP: Simple, Validate if string is hex?
Posted
by oni-kun
on Stack Overflow
See other posts from Stack Overflow
or by oni-kun
Published on 2010-04-15T06:23:55Z
Indexed on
2010/04/15
6:33 UTC
Read the original article
Hit count: 315
I have no clue how to validate this string. I am simply supplying an IV for an encryption, but can find no "is_hex()" or similar function, I can't wrap my head around it! I read on a comment in the php documentation (user contrib. notes) this:
if($iv == dechex(hexdec($iv))) {
//True
} else {
//False
}
But that doesn't seem to work at all.. It only says false. If it helps my input of my IV would be this:
92bff433cc639a6d
© Stack Overflow or respective owner