protected static function makeBin($str, $len)
    {
        if ($str instanceof self) {
            return $str->bytes;
        }
        if (\strlen($str) === $len) {
            return $str;
        }

        $str = (string)preg_replace([
            // strip URN scheme and namespace
            '/^urn:uuid:/is',
            // strip non-hex characters
            '/[^a-f0-9]/is',
        ], '', $str);

        if (\strlen($str) !== ($len * 2)) {
            return null;
        }

        return pack('H*', $str);
    }