Skip to main content

Module utils

Module utils 

Source
Expand description

Utility functions and data structures for BEAM.

This module provides:

  • random_string — a cryptographically random alphanumeric string generator used for message IDs and actor addresses.
  • BoundedHashMap — a fixed-capacity FIFO-eviction map used for deduplication tracking (seen message IDs, etc.).

§Security Note

random_string uses rand::thread_rng which is backed by the OS CSPRNG. This is suitable for message IDs and session tokens but is not suitable for cryptographic key generation — use the crate::sea module’s generate_pair() for key generation.

Structs§

BoundedHashMap
A fixed-capacity hash map that evicts the oldest entries when full.

Functions§

random_string
Generates a random alphanumeric string of the given length.

Type Aliases§

DefaultHasher
Default hasher for non-cryptographic HashMaps/HashSets in BEAM.
FxHashMap
Type alias for a hash map that uses the Fx hashing algorithm.
FxHashSet
Type alias for a hash set that uses the Fx hashing algorithm.