protected static function mintName($ver, $node, $ns): string
    {
        if (empty($node)) {
            throw new \InvalidArgumentException('A name-string is required for Version 3 or 5 UUIDs.');
        }

        // if the namespace UUID isn't binary, make it so
        $ns = static::makeBin($ns, 16);
        if (null === $ns) {
            throw new \InvalidArgumentException('A binary namespace is required for Version 3 or 5 UUIDs.');
        }

        $version = $uuid = null;

        switch ($ver) {
            case static::MD5:
                $version = static::VERSION_3;
                $uuid = \md5($ns . $node, 1);
                break;
            case static::SHA1:
                $version = static::VERSION_5;
                $uuid = \substr(\sha1($ns . $node, 1), 0, 16);
                break;
            default:
                // no default really required here
        }

        // set variant
        $uuid[8] = \chr(\ord($uuid[8]) & static::CLEAR_VAR | static::VAR_RFC);

        // set version
        $uuid[6] = \chr(\ord($uuid[6]) & static::CLEAR_VER | $version);

        return $uuid;
    }