开发者

PHP crc32() only numbers

开发者 https://www.devze.com 2022-12-24 20:54 出处:网络
I have a MD5 hash: 10f86782177490f2ac970b8dc4开发者_如何转开发c51014 http://www.fileformat.info/tool/hash.htm?text=10f86782177490f2ac970b8dc4c51014

I have a MD5 hash: 10f86782177490f2ac970b8dc4开发者_如何转开发c51014

http://www.fileformat.info/tool/hash.htm?text=10f86782177490f2ac970b8dc4c51014 Result: c74e16d9

but PHP: crc32('10f86782177490f2ac970b8dc4c51014'); Result: -951183655

I don't understand!


It's only a matter of representation of the data :

  • c74e16d9 is the hexadecimal representation
  • and -951183655 is the decimal representation.


And here's a portion of code to illustrate that :

$crc = crc32('10f86782177490f2ac970b8dc4c51014');
var_dump($crc);
var_dump(dechex($crc));

It'll display :

int -951183655
string 'c74e16d9' (length=8)

Which corresponds to :

  • The decimal representation of the value of your CRC
  • and, after that, the hexadecimal represenation of that same value.
0

精彩评论

暂无评论...
验证码 换一张
取 消