function UuidFactory::uuidFromNsAndName
Returns a version 3 or 5 namespaced Uuid
@psalm-pure
Parameters
string|UuidInterface $ns The namespace (must be a valid UUID):
string $name The name to hash together with the namespace:
int $version The version of UUID to create (3 or 5):
string $hashAlgorithm The hashing algorithm to use when hashing: together the namespace and name
Return value
UuidInterface An instance of UuidInterface, created by hashing together the provided namespace and name
2 calls to UuidFactory::uuidFromNsAndName()
- UuidFactory::uuid3 in vendor/
ramsey/ uuid/ src/ UuidFactory.php - @inheritDoc @psalm-pure
- UuidFactory::uuid5 in vendor/
ramsey/ uuid/ src/ UuidFactory.php - @inheritDoc @psalm-pure
File
-
vendor/
ramsey/ uuid/ src/ UuidFactory.php, line 465
Class
Namespace
Ramsey\UuidCode
private function uuidFromNsAndName(UuidInterface|string $ns, string $name, int $version, string $hashAlgorithm) : UuidInterface {
if (!$ns instanceof UuidInterface) {
$ns = $this->fromString($ns);
}
$bytes = $this->nameGenerator
->generate($ns, $name, $hashAlgorithm);
return $this->uuidFromBytesAndVersion(substr($bytes, 0, 16), $version);
}