std/uuid/mod.ts

Deno standard library
Go to Latest
function v5.generate
import { v5 } from "https://deno.land/std@0.151.0/uuid/mod.ts?s=v5.generate";

const { generate } = v5;

Generate a RFC4122 v5 UUID (SHA-1 namespace).

import { generate } from "./v5.ts";

const NAMESPACE_URL = "6ba7b810-9dad-11d1-80b4-00c04fd430c8";

const uuid = await generate(NAMESPACE_URL, new TextEncoder().encode("python.org"));
uuid === "886313e1-3b8a-5372-9b90-0c9aee199e5d" // true

Parameters

namespace: string[src]

The namespace to use, encoded as a UUID.

data: Uint8Array[src]

The data to hash to calculate the SHA-1 digest for the UUID.

Returns

Promise<string>[src]