From 47d2e3b1424bdbc903a84ea94b9d3c7dfe4b5c9f Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Wed, 3 Feb 2016 05:00:26 +0100 Subject: [PATCH] Added some documentation --- include/items.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/items.php b/include/items.php index ff5d919c9..c149660fa 100644 --- a/include/items.php +++ b/include/items.php @@ -773,13 +773,25 @@ function item_add_language_opt(&$arr) { } } +/** + * @brief Creates an unique guid out of a given uri + * + * @param string $uri uri of an item entry + * @return string unique guid + */ function uri_to_guid($uri) { + + // Our regular guid routine is using this kind of prefix as well + // We have to avoid that different routines could accidentally create the same value $parsed = parse_url($uri); $guid_prefix = hash("crc32", $parsed["host"]); + // Remove the scheme to make sure that "https" and "http" doesn't make a difference unset($parsed["scheme"]); $host_id = implode("/", $parsed); + + // We could use any hash algorithm since it isn't a security issue $host_hash = hash("ripemd128", $host_id); return $guid_prefix.$host_hash;