protected static function _encodeSubIDs(\GMP ...$subids): string
    {
        $data = "";
        foreach ($subids as $subid) {
            // if number fits to one base 128 byte
            if ($subid < 128) {
                $data .= chr(intval($subid));
            } else { // encode to multiple bytes
                $bytes = [];
                do {
                    array_unshift($bytes, 0x7f & gmp_intval($subid));
                    $subid >>= 7;
                } while ($subid > 0);
                // all bytes except last must have bit 8 set to one
                foreach (array_splice($bytes, 0, -1) as $byte) {
                    $data .= chr(0x80 | $byte);
                }
                $data .= chr(reset($bytes));
            }
        }
        return $data;
    }