Search documentation of macula

# macula_id (macula v4.4.9)

View Source

ID generation utilities for Macula. Provides functions for generating various types of IDs.

# Summary

## Functions

from_hex(Hex)

Convert hex string to binary. Crashes on invalid hex - exposes bugs in validation logic.

from_uuid(Uuid)

Convert UUID string to 16-byte binary ID. Crashes on invalid UUID format - exposes bugs in validation logic.

hash_id(Data)

Generate deterministic 256-bit hash ID from data.

message_id()

Generate 128-bit (16-byte) random message ID.

node_id()

Generate 256-bit (32-byte) random node ID.

session_id()

Generate 128-bit (16-byte) random session ID.

to_hex(Binary)

Convert binary to lowercase hex string.

to_uuid(_)

Convert 16-byte or 32-byte binary ID to UUID string format. For 16-byte: 8-4-4-4-12 (e.g., "12345678-90ab-cdef-1234-567890abcdef") For 32-byte: Uses first 16 bytes

# Functions

# from_hex(Hex)

    -spec from_hex(binary()) -> binary().

Convert hex string to binary. Crashes on invalid hex - exposes bugs in validation logic.

# from_uuid(Uuid)

    -spec from_uuid(binary()) -> binary().

Convert UUID string to 16-byte binary ID. Crashes on invalid UUID format - exposes bugs in validation logic.

# hash_id(Data)

    -spec hash_id(binary()) -> binary().

Generate deterministic 256-bit hash ID from data.

# message_id()

    -spec message_id() -> binary().

Generate 128-bit (16-byte) random message ID.

# node_id()

    -spec node_id() -> binary().

Generate 256-bit (32-byte) random node ID.

# session_id()

    -spec session_id() -> binary().

Generate 128-bit (16-byte) random session ID.

# to_hex(Binary)

    -spec to_hex(binary()) -> binary().

Convert binary to lowercase hex string.

# to_uuid(_)

    -spec to_uuid(binary()) -> binary().

Convert 16-byte or 32-byte binary ID to UUID string format. For 16-byte: 8-4-4-4-12 (e.g., "12345678-90ab-cdef-1234-567890abcdef") For 32-byte: Uses first 16 bytes