public static function GUIDv5($namespace, $name)
    {
        if (!Validate::isGuid($namespace)) {
            return false;
        }

        $nHex = str_replace(['-', '{', '}'], '', $namespace);
        $nStr = '';

        $nHexLen = \strlen($nHex);
        for ($i = 0; $i < $nHexLen; $i += 2) {
            $nStr .= \chr(\intval($nHex[$i] . $nHex[$i + 1], 16));
        }

        $hash = sha1($nStr . $name);

        return sprintf(
            '%08s-%04s-%04x-%04x-%12s',
            substr($hash, 0, 8),
            substr($hash, 8, 4),
            (\intval(substr($hash, 12, 4), 16) & 0x0fff) | 0x5000,
            (\intval(substr($hash, 16, 4), 16) & 0x3fff) | 0x8000,
            substr($hash, 20, 12)
        );
    }
public static function GUIDv5($namespace, $name)
    {
        if (!Validate::isGuid($namespace)) {
            return false;
        }

        $nHex = str_replace(['-', '{', '}'], '', $namespace);
        $nStr = '';

        $nHexLen = \strlen($nHex);
        for ($i = 0; $i < $nHexLen; $i += 2) {
            $nStr .= \chr(\intval($nHex[$i] . $nHex[$i + 1], 16));
        }

        $hash = sha1($nStr . $name);

        return sprintf(
            '%08s-%04s-%04x-%04x-%12s',
            substr($hash, 0, 8),
            substr($hash, 8, 4),
            (\intval(substr($hash, 12, 4), 16) & 0x0fff) | 0x5000,
            (\intval(substr($hash, 16, 4), 16) & 0x3fff) | 0x8000,
            substr($hash, 20, 12)
        );
    }
public static function GUIDv5 ( $ namespace , $ name ) { if ( ! Validate :: isGuid ( $ namespace ) ) { return false ; } $ nHex = str_replace ( [ '-' , '{' , '}' ] , '' , $ namespace ) ; $ nStr = '' ; $ nHexLen = \ strlen ( $ nHex ) ; for ( $ i = 0 ; $ i < $ nHexLen ; $ i += 2 ) { $ nStr .= \ chr ( \ intval ( $ nHex [ $ i ] . $ nHex [ $ i + 1 ] , 16 ) ) ; } $ hash = sha1 ( $ nStr . $ name ) ; return sprintf ( '%08s-%04s-%04x-%04x-%12s' , substr ( $ hash , 0 , 8 ) , substr ( $ hash , 8 , 4 ) , ( \ intval ( substr ( $ hash , 12 , 4 ) , 16 ) & 0x0fff ) | 0x5000 , ( \ intval ( substr ( $ hash , 16 , 4 ) , 16 ) & 0x3fff ) | 0x8000 , substr ( $ hash , 20 , 12 ) ) ; }
Generate v5 UUID

Version 5 UUIDs are named based. They require a namespace (another
valid UUID) and a value (the name). Given the same namespace and
name, the output is always the same.

@param string $namespace Valid namespace (GUID)
@param string $name Valid name (value)

@return string|bool GUIDv5 or false when the namespace is not a valid GUID
@static
Generate v5 UUID