uuid_v5

package
v1.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UUIDv5NamespaceDNS  = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
	UUIDv5NamespaceURL  = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
	UUIDv5NamespaceOID  = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
	UUIDv5NamespaceX500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
)

UUIDv5 namespaces Source: https://www.rfc-editor.org/rfc/rfc4122#appendix-C

Variables

This section is empty.

Functions

This section is empty.

Types

type UUIDv5

type UUIDv5 struct {
	uuid.UUID

	Namespace uuid.UUIDInterface

	Name string
	// contains filtered or unexported fields
}

UUIDv5 is a name-based UUID (version 5). It is derived from SHA-1(namespaceUUID || name) with version=5 and RFC 4122 variant.

func (*UUIDv5) FromString

func (u *UUIDv5) FromString(uuidStr string) error

FromString parses a UUID string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" and returns a UUIDv5 structure.

Parameters:

  • uuidStr: A string containing the UUID in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

Returns:

  • An error if the UUID is invalid or the conversion fails

func (*UUIDv5) Marshal

func (u *UUIDv5) Marshal() ([]byte, error)

Marshal converts the UUIDv5 structure to a 16-byte array

Returns:

  • A byte slice containing the UUID's 16 bytes
  • An error if the UUID is invalid or the conversion fails

func (*UUIDv5) String

func (u *UUIDv5) String() string

String returns the string representation of the UUIDv5 structure

Returns:

  • The string representation of the UUIDv5 structure

func (*UUIDv5) Unmarshal

func (u *UUIDv5) Unmarshal(marshalledData []byte) (int, error)

Unmarshal converts a 16-byte array into a UUIDv5 structure

Returns:

  • The number of bytes read
  • An error if the UUID is invalid or the conversion fails

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL