Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建 100.000 个唯一的 8 个字符串的数组。对于输入,我有从 1 到 100.000 的整数数组。我打算使用crc32。我可以假设不会有任何碰撞吗?PS我只担心碰撞..
这是你的答案。
$result = array(); for ($i = 1; $i <= 100000; ++$i) $result[sprintf('_%u', crc32($i))] = true; if (count($result) == 100000) { echo 'Yes, you can use CRC32.'; } else { echo 'Ooops, you better use another algorithm.'; }