public function v3(string $namespace, string $identifier, bool $optimize = true): string
    {
        switch ($namespace) {
            case 'dns':
                $namespace = UuidGen::NAMESPACE_DNS;
                break; // Stop here.

            case 'url':
                $namespace = UuidGen::NAMESPACE_URL;
                break; // Stop here.

            case 'oid':
                $namespace = UuidGen::NAMESPACE_OID;
                break; // Stop here.

            case 'x500':
                $namespace = UuidGen::NAMESPACE_X500;
                break; // Stop here.

            default:
                $this->c::issue('Invalid namespace.');
        }
        $uuid = UuidGen::uuid3($namespace, $identifier)->toString();

        return $optimize ? str_replace('-', '', $uuid) : $uuid;
    }
public function v3(string $namespace, string $identifier, bool $optimize = true): string
    {
        switch ($namespace) {
            case 'dns':
                $namespace = UuidGen::NAMESPACE_DNS;
                break; // Stop here.

            case 'url':
                $namespace = UuidGen::NAMESPACE_URL;
                break; // Stop here.

            case 'oid':
                $namespace = UuidGen::NAMESPACE_OID;
                break; // Stop here.

            case 'x500':
                $namespace = UuidGen::NAMESPACE_X500;
                break; // Stop here.

            default:
                $this->c::issue('Invalid namespace.');
        }
        $uuid = UuidGen::uuid3($namespace, $identifier)->toString();

        return $optimize ? str_replace('-', '', $uuid) : $uuid;
    }
public function v3 ( string $ namespace , string $ identifier , bool $ optimize = true ) : string { switch ( $ namespace ) { case 'dns' : $ namespace = UuidGen :: NAMESPACE_DNS ; break ; // Stop here. case 'url' : $ namespace = UuidGen :: NAMESPACE_URL ; break ; // Stop here. case 'oid' : $ namespace = UuidGen :: NAMESPACE_OID ; break ; // Stop here. case 'x500' : $ namespace = UuidGen :: NAMESPACE_X500 ; break ; // Stop here. default : $ this -> c :: issue ( 'Invalid namespace.' ) ; } $ uuid = UuidGen :: uuid3 ( $ namespace , $ identifier ) -> toString ( ) ; return $ optimize ? str_replace ( '-' , '' , $ uuid ) : $ uuid ; }
UUID v3 generator.

@since 150424 Initial release.

@param string $namespace  Namespace.
@param string $identifier Identifier.
@param bool   $optimize   Optimize?

@return string Version 3 UUID (32 bytes optimized).
Or 36 bytes unoptimized; i.e., w/ dashes.

@internal {@link v5()} is a suggested alternative, as this version uses MD5.
UUID v3 generator .