From 877eccf539bfd3a365d8658ed63d096a13e57b00 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Fri, 18 Dec 2015 13:52:19 -0500 Subject: + Implemented Object::getNewGUID function for Object class --- app/class/object.class.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/class/object.class.php') diff --git a/app/class/object.class.php b/app/class/object.class.php index fe487bc..7a46e6e 100644 --- a/app/class/object.class.php +++ b/app/class/object.class.php @@ -192,6 +192,21 @@ abstract class Object extends Framework return false; } + + /* + * Get a new, unique GUID for a new system object + */ + function getNewGUID() + { + do + { + $sha = hash("sha256", random_bytes(64)); + $guid = substr($sha, 0, 8); + } + while ($this->isGUID($guid)); + + return $guid; + } } ?> -- cgit v1.2.3