uuid_v3
import "github.com/TheManticoreProject/Manticore/crypto/uuid/uuid_v3"
Index
Constants
UUIDv3 namespaces Source: https://www.rfc-editor.org/rfc/rfc4122#appendix-C
const (
UUIDv3NamespaceDNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
UUIDv3NamespaceURL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"
UUIDv3NamespaceOID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"
UUIDv3NamespaceX500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"
)
type UUIDv3
UUIDv3 is a name-based UUID (version 3). It is derived from MD5(namespaceUUID || name) with version=3 and RFC 4122 variant.
type UUIDv3 struct {
uuid.UUID
Namespace uuid.UUIDInterface
Name string
// contains filtered or unexported fields
}
func (*UUIDv3) FromString
func (u *UUIDv3) FromString(uuidStr string) error
FromString parses a UUID string in the format “xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx” and returns a UUIDv3 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 (*UUIDv3) Marshal
func (u *UUIDv3) Marshal() ([]byte, error)
Marshal converts the UUIDv3 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 (*UUIDv3) String
func (u *UUIDv3) String() string
String returns the string representation of the UUIDv3 structure
Returns:
- The string representation of the UUIDv3 structure
func (*UUIDv3) Unmarshal
func (u *UUIDv3) Unmarshal(marshalledData []byte) (int, error)
Unmarshal converts a 16-byte array into a UUIDv3 structure
Returns:
- The number of bytes read
- An error if the UUID is invalid or the conversion fails