Crc32 module mapping to a machine, how to make a key plus some factors scattered to the machine?

as the title shows, the crc32 module is mapped to a certain machine
for example, my key is generated according to an ID, which is similar to key_1000,. I want to add something to this key. Is there any way to write this key on each machine? the premise is that I don"t want to change the underlying module according to crc32.
if there are three machines, I think three key, like key_1000_0, key_1000_1, key_1000_2 are tested frequently. In some cases, it is not possible to have all three machines. It is possible that the two key_1000_0, key_1000_1 machines are on machine A, and machine B and machine key_1000_2, C do not have this key

.
Php
Mar.17,2021

there is no universal "factor". You need to add different "factors" to different key,.

if you just want to cover all the machines, you can cycle through crc32.

<?php

function gen_key($key, $mod)
{

    $result = [];
    $i = 0;
    while (count($result) < $mod) {
        $new_key = $key . '_' . $i;
        $k = crc32($new_key) % $mod;
        $i = $i + 1;
        if (!isset($result[$k])) {
            $result[$k] = $new_key;
        }
    }
    return $result;
}

output example: https://3v4l.org/VjLpr

Menu