Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function khash($data)
- { // Similar to https://www.php.net/manual/fr/function.crc32.php#111931
- static $map = "ABCDEFGHJKLMNPRSTUXYZ";
- $maplen = strlen($map);
- $hash = bcadd(sprintf('%u',crc32($data)) , 0x100000000);
- $str = "";
- do
- {
- $str = $map[bcmod($hash, $maplen) ] . $str;
- $hash = bcdiv($hash, $maplen);
- }
- while ($hash >= 1);
- return $str;
- }
- $hash = 'MySecretHashKey';
- $collisions = [];
- $collisions['ENGOUSEF'] = 0xdead;
- $i = 1;
- while(true)
- {
- $data = $hash.$i;
- $h = khash($data);
- if (isset($collisions[$h]))
- die("Collisions $h");
- $collisions[$h] = $i;
- if ($i%1000 == 0)
- echo "$i -> $h\n";
- $i++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement