From: Raphaƫl Gertz Date: Mon, 3 Oct 2022 00:39:10 +0000 (+0200) Subject: Add array hashing X-Git-Tag: 0.2.1~18 X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/packbundle/commitdiff_plain/9d0a8f506d7b005236a693838ffefc655df2e39f Add array hashing --- diff --git a/Util/SluggerUtil.php b/Util/SluggerUtil.php index de8ce1b..8dc50df 100644 --- a/Util/SluggerUtil.php +++ b/Util/SluggerUtil.php @@ -118,10 +118,16 @@ class SluggerUtil { /** * Crypt and base64uri encode string * - * @param string $data The data string + * @param array|string $data The data string * @return string The hashed data */ - public function hash(string $data): string { + public function hash(array|string $data): string { + //With array + if (is_array($data)) { + //Json encode array + $data = json_encode($data); + } + //Return hashed data //XXX: we use hash_hmac with md5 hash //XXX: crypt was dropped because it provided identical signature for string starting with same pattern