Generated from Manticore v1.1.5 • 201 packages. View on pkg.go.dev

uuid_v5

import "github.com/TheManticoreProject/Manticore/crypto/uuid/uuid_v5"

Index

Constants

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

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"
)

type UUIDv5

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

type UUIDv5 struct {
    uuid.UUID

    Namespace uuid.UUIDInterface

    Name string
    // contains filtered or unexported fields
}

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