From 7d1c409e39ccf3e9058e31a83051a500489dd841 Mon Sep 17 00:00:00 2001 From: Andy Pieters Date: Fri, 23 Mar 2018 13:47:02 +0100 Subject: [PATCH] The uuid should be in hex. Converted the reference to hex, reference can only be 8 chars now --- samples/DynamicUUID/decode.php | 2 +- samples/DynamicUUID/encode.php | 2 +- src/DynamicUUID.php | 21 ++++++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/samples/DynamicUUID/decode.php b/samples/DynamicUUID/decode.php index 0116442c..4828f3aa 100644 --- a/samples/DynamicUUID/decode.php +++ b/samples/DynamicUUID/decode.php @@ -1,7 +1,7 @@ $serviceId, 'reference' => $reference @@ -115,7 +126,7 @@ public static function validate($uuid, $secret) $uuidData = substr($uuidData, 8); $hash = hash_hmac('sha256', $uuidData, $secret); - $checksum = "sl" . substr($hash, 0, 6); + $checksum = "b" . substr($hash, 0, 7); return $checksum == substr($uuid, 0, 8); }