slim - ramsey/uuid - validate a name-based hashed has the name that we assign it to the uuid -
any reliable uuid package packagist can download , use slim framework?
ideally,i uuid can hash type, e.g. php, string. can check if uuid has 'php'.
edit:
how can validate name-based hashed has name assign uuid?
// generate version 3 (name-based , hashed md5) uuid object $uuid3 = uuid::uuid3(uuid::namespace_dns, 'php.net'); $uuid = $uuid3->tostring();
for instance:
if ($uuid3->getname($uuid) === 'php.net') { // }
is possible?
the best uuid package https://github.com/ramsey/uuid
just use composer require ramsey/uuid
install it.
ideally,i uuid can hash type, e.g. php, string. can check if uuid has 'php'.
i don't understand this. uuids create unique string. wikipedia:
a universally unique identifier (uuid) 128-bit number used identify information in computer systems. term globally unique identifier (guid) used.
when generated according standard methods, uuids practical purposes unique, without depending uniqueness on central registration authority or coordination between parties generating them
edit.
to answer new question…
you can't reverse hash, need hash again , compare.
$uuid = uuid::uuid3(uuid::namespace_dns, 'php.net')->tostring(); $domainfromuser = 'example.com'; $useruuid = uuid::uuid3(uuid::namespace_dns, $domainfromuser)->tostring(); if ($uuid === $useruuid) { // user provided right domain }
Comments
Post a Comment