<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Uuid on Micha Kops&#39; Tech Notes</title>
    <link>https://www.hascode.com/tags/uuid/</link>
    <description>Recent content in Uuid on Micha Kops&#39; Tech Notes</description>
    <generator>Hugo</generator>
    <language>en</language>
    <copyright>Copyright © 2010 - 2025 Micha Kops. #e9d956c0c0154a221ad83c925346a8fa0e72f866</copyright>
    <lastBuildDate>Sun, 02 Feb 2020 00:00:00 +0100</lastBuildDate>
    <atom:link href="https://www.hascode.com/tags/uuid/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>UUID Generator</title>
      <link>https://www.hascode.com/tools/uuid/</link>
      <pubDate>Sun, 02 Feb 2020 00:00:00 +0100</pubDate>
      <guid>https://www.hascode.com/tools/uuid/</guid>
      <description>&lt;!DOCTYPE html&gt;
&lt;html lang=&#34;en&#34;&gt;
&lt;head&gt;
    &lt;meta charset=&#34;UTF-8&#34;&gt;
    &lt;meta name=&#34;viewport&#34; content=&#34;width=device-width, initial-scale=1.0&#34;&gt;
    &lt;title&gt;UUID Generator&lt;/title&gt;
    &lt;script type=&#34;module&#34;&gt;
        import { v1 as uuidv1, v3 as uuidv3, v4 as uuidv4 } from &#34;https://cdn.jsdelivr.net/npm/uuid@9.0.0/+esm&#34;;
        window.uuidv1 = uuidv1;
        window.uuidv3 = uuidv3;
        window.uuidv4 = uuidv4;
    &lt;/script&gt;    
&lt;/head&gt;
&lt;body&gt;
  &lt;div class=&#34;custom-tools&#34;&gt;
    &lt;h2&gt;UUID Generator&lt;/h2&gt;

    &lt;div class=&#34;button-group&#34;&gt;
      &lt;button onclick=&#34;generateUUID(&#39;v1&#39;)&#34;&gt;Generate UUID v1&lt;/button&gt;
      &lt;button onclick=&#34;generateUUID(&#39;v4&#39;)&#34;&gt;Generate UUID v4&lt;/button&gt;
    &lt;/div&gt;

    &lt;label for=&#34;uuidOutput&#34;&gt;Generated UUID:&lt;/label&gt;
    &lt;input type=&#34;text&#34; id=&#34;uuidOutput&#34; readonly&gt;

    &lt;h3&gt;UUID v3&lt;/h3&gt;

    &lt;label for=&#34;namespace&#34;&gt;Namespace UUID:&lt;/label&gt;
    &lt;input type=&#34;text&#34; id=&#34;namespace&#34; placeholder=&#34;Enter Namespace UUID&#34;&gt;

    &lt;label for=&#34;name&#34;&gt;Name:&lt;/label&gt;
    &lt;input type=&#34;text&#34; id=&#34;name&#34; placeholder=&#34;Enter Name&#34;&gt;

    &lt;div class=&#34;button-group&#34;&gt;
      &lt;button onclick=&#34;generateUUID(&#39;v3&#39;)&#34;&gt;Generate UUID v3&lt;/button&gt;
    &lt;/div&gt;
  &lt;/div&gt;    
    &lt;script&gt;
        function isValidUUID(uuid) {
            const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
            return uuidRegex.test(uuid);
        }

        function generateUUID(version) {
            let uuid;
            if (version === &#39;v1&#39;) {
                uuid = window.uuidv1();
            } else if (version === &#39;v4&#39;) {
                uuid = window.uuidv4();
            } else if (version === &#39;v3&#39;) {
                let namespace = document.getElementById(&#39;namespace&#39;).value.trim();
                const name = document.getElementById(&#39;name&#39;).value.trim();
                if (!namespace || !isValidUUID(namespace)) {
                    alert(&#39;Invalid or missing namespace UUID. Using default namespace.&#39;);
                    namespace = &#39;6ba7b810-9dad-11d1-80b4-00c04fd430c8&#39;; // Default DNS namespace UUID
                }
                if (!name) {
                    alert(&#39;Please enter a name.&#39;);
                    return;
                }
                uuid = window.uuidv3(name, namespace);
            }
            document.getElementById(&#39;uuidOutput&#39;).value = uuid;
        }
    &lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</description>
    </item>
  </channel>
</rss>
